↔️
Anagrams
Week 37
Your friend poses an interesting question - "dog" is an anagram of "god" (that is, words that feature exactly the same letters and letter frequencies (note that "good" is NOT considered an anagram of "dog", since it has 2 "o"'s, while "dog" only has 1), but just arranged in a different order) - they are interested in ALL the examples of anagrams in the English language. They will use this both for curiosity and when playing many word games like Scrabble, Wordle, Boggle, Countdown etc. Other examples would be "listen" and "silent", "evil" and "vile", "ogre" and "gore" etc
Suppose you have the following word list:
Your program should take that data and output information in the following format - note:
- Lines should be ordered in descending order of the anagram count - i.e. in this example of 12 words, we see the letters with 4 anagrams at the top, then 3, 2, 1...
- Words should be ordered alphabetically within the line - i.e. "angered" is first for the anagrams that can be made with those letters, while "grenade" is last
- For groups with the same count - e.g. "tycoon", "rollercoaster" and "code" are all in groups containing only 1 word, then they can be displayed in any order - here, the lines go tycoon, rollercoaster, code...but another order like code, rollercoaster, tycoon will also be accepted
- Include a final count of the total number of anagrams from all words at the end, in the exact format as shown below
Above was just an example - for your program, you should use this word list
Hints
Hints will be released at the start of each of the following days - e.g. the start of day 3 is 48 hours after the challenge starts
| Release Day | Hint |
|---|---|
| 2 |