Pregunta de entrevista de Indus Valley Partners

OOPs, String Manipulation Question and puzzle.