Pergunta de entrevista da empresa Google

An algorithm question about string.