Frage im Vorstellungsgespräch bei Indus Valley Partners

OOPs, String Manipulation Question and puzzle.