Sorting Anagrams in a array