Infosys interview question

Coding exam: about string manipulation