Let's Be an Anagrammatist

Limits: 1s, 512 MB

Do you know what is an anagram? An anagram is a rearrangement of letters of one word to form another word. For example: one of the anagrams of the word “CODEMASK” can be “DEMOCSAK”. So, we can find different kinds of anagram of a word.

This is a companion discussion topic for the original entry at https://toph.co/p/lets-be-an-anagrammatist