Kata of the week: Anagrams
(20.-24. February 2017)
Given a file containing one word per line, print out all the combinations of words that are anagrams;
each line in the output contains all the words from the input that are anagrams of each other.
For example, your program might include in its output:
kinship pinkish
enlist inlets listen silent
boaster boaters borates
fresher refresh
sinks skins
knits stink
rots sort
If you run this on the word list here (http://codekata.com/data/wordlist.txt) you should find 20683 sets of
anagrams (a total of 48162 words), including all-time favorites such as
crepitus cuprites pictures piecrust
paste pates peats septa spate tapes tepas
punctilio unpolitic
sunders undress
For added programming pleasure, find the longest words that are anagrams, and find the set of anagrams
containing the most words (so “parsley players replays sparely” would not win, having only four words in the set).
Source and full description: http://codekata.com/kata/kata06-anagrams/
if working with files in tests turns out difficult for whatever reason, feel free to use other forms of input/output.
Bonus points if you still manage to optimize for big word lists after making it just work