Google interview question

An algorithm question about string.