sort strings to put anagrams together