Pergunta de entrevista da empresa Morgan Stanley

Question on anagrams. Rewording strings in the most efficient way