Infosys interview question

They asked a simple string manipulation question.