How would you list words that are anagrams of each other?
I was asked this question when I applied for my current job.
orchestra
can be rearranged into carthorse
with all original letters used exactly once therefore the words are anagrams of each other.
Put all the letters in alphabetical order in the string (sorting algorithm) and then compare the resulting string.