Pregunta de entrevista de Miro

String manipulation based question in Javascript