def is_anagram?(string1, string2) string1.chars.to_a.sort == string2.chars.to_a.sort end words_file = File.read("input.txt") words = words_file.split(" ") puts is_anagram?(words[0], words[1])