Pregunta de entrevista de Amazon Web Services

String manupulation Hackerrank question on DataStructures