def detect(words):
    output_words = words.split('?')
    words = words.replace(' ', '').replace("'", '').lower().split('?')
    word_1 = list(''.join(sorted(words[0])))
    word_2 = list(''.join(sorted(words[1])))
    if word_1 == word_2:
        print(output_words[0] + "is an anagram of" + output_words[1])
    else:
        print(output_words[0] + "is NOT an anagram of" + output_words[1])

detect("Clint Eastwood ? Old West Action")
detect("parliament ? partial man")
detect("wisdom ? mid sow")
detect("Seth Rogan ? Gathers No")
detect("Reddit ? Eat Dirt")
detect("Schoolmaster ? The classroom")
detect("Astronomers ? Moon starer")
detect("Vacation Times ? I'm Not as Active")
detect("Dormitory ? Dirty Rooms")