Replace #each_with_object by #select in anagram