Anagrams in a dictionary

This program groups together all anagrams in an input set of strings.
This solution is from a discussion on stackoverflow.
I was asked the very same question on an interview recently, hence I decided to use it