Pregunta de entrevista de Amazon

Accept a continuous string input and manipulate it as required.