fork download
  1. def detect(words):
  2. output_words = words.split('?')
  3. words = words.replace(' ', '').replace("'", '').lower().split('?')
  4. word_1 = list(''.join(sorted(words[0])))
  5. word_2 = list(''.join(sorted(words[1])))
  6. if word_1 == word_2:
  7. print(output_words[0] + "is an anagram of" + output_words[1])
  8. else:
  9. print(output_words[0] + "is NOT an anagram of" + output_words[1])
  10.  
  11. detect("Clint Eastwood ? Old West Action")
  12. detect("parliament ? partial man")
  13. detect("wisdom ? mid sow")
  14. detect("Seth Rogan ? Gathers No")
  15. detect("Reddit ? Eat Dirt")
  16. detect("Schoolmaster ? The classroom")
  17. detect("Astronomers ? Moon starer")
  18. detect("Vacation Times ? I'm Not as Active")
  19. detect("Dormitory ? Dirty Rooms")
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
stdout
Clint Eastwood is an anagram of Old West Action
parliament is NOT an anagram of partial man
wisdom is an anagram of mid sow
Seth Rogan is an anagram of Gathers No
Reddit is NOT an anagram of Eat Dirt
Schoolmaster is an anagram of The classroom
Astronomers is NOT an anagram of Moon starer
Vacation Times is an anagram of I'm Not as Active
Dormitory is NOT an anagram of Dirty Rooms