reading input for anagrams