Infosys Interview Question

Programming question on strings and swapping