Pergunta de entrevista da empresa Verdantis

I was asked to write a logic for anagram words