iteration on anagram