Infosys Interview Question

They asked a simple string manipulation question.