Indus Valley Partners interview question

OOPs, String Manipulation Question and puzzle.