Pregunta de entrevista de Google

An algorithm question about string.