Domanda di colloquio di Morgan Stanley

Question on anagrams. Rewording strings in the most efficient way