Infosys interview question

Programming question on strings and swapping