Refactor anagram.rb