2019-10-28 18:26:22 +01:00
|
|
|
#!/usr/bin/python3
|
2019-10-28 19:39:05 +01:00
|
|
|
import sys
|
2019-10-28 18:26:22 +01:00
|
|
|
import re
|
|
|
|
|
|
|
|
alph_num_dict = {
|
|
|
|
'a': '2', 'b': '2', 'c': '2',
|
|
|
|
'd': '3', 'e': '3', 'f': '3',
|
|
|
|
'g': '4', 'h': '4', 'i': '4',
|
|
|
|
'j': '5', 'k': '5', 'l': '5',
|
|
|
|
'm': '6', 'n': '6', 'o': '6',
|
|
|
|
'p': '7', 'q': '7', 'r': '7',
|
|
|
|
's': '7',
|
|
|
|
'u': '8', 'w': '9', 'v': '8',
|
|
|
|
'w': '9', 'x': '9', 'y': '9',
|
2019-10-28 19:44:11 +01:00
|
|
|
'z': '9', ' ': ' ', '\n': ''
|
2019-10-28 18:26:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
def translate(text):
|
|
|
|
response = ""
|
2019-10-28 19:42:41 +01:00
|
|
|
for i in text.lower()[::-1]:
|
2019-10-28 18:26:22 +01:00
|
|
|
response += alph_num_dict[i]
|
|
|
|
return response
|
|
|
|
|
|
|
|
def is_number(text):
|
|
|
|
pattern = re.compile(r'^[A-Z]{5} [A-Z]{4}$')
|
|
|
|
|
|
|
|
result = re.match(pattern, text)
|
|
|
|
if result and translate(text)!=translate("HORSE HEAD"):
|
|
|
|
return "yes"
|
|
|
|
else:
|
|
|
|
return "no"
|
|
|
|
|
2019-10-28 19:36:44 +01:00
|
|
|
for line in sys.stdin:
|
|
|
|
print(is_number(line))
|