Pregunta de entrevista de Google

Algorithm question about parsing and encrypting strings