ByteDance interview question

a string based coding question