Skip to content

Instantly share code, notes, and snippets.

@g-p-g
Created January 19, 2015 22:03
Show Gist options
  • Save g-p-g/8be54b08db4284bf5461 to your computer and use it in GitHub Desktop.
Save g-p-g/8be54b08db4284bf5461 to your computer and use it in GitHub Desktop.
import sys
from string import maketrans
trans = maketrans(
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'22233344455566677778889999'
)
num = int(sys.stdin.next())
for line in sys.stdin:
res = line.strip().upper().translate(trans)
print 'YES' if res == res[::-1] else 'NO'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment