Skip to content

Instantly share code, notes, and snippets.

@kaz-tk
Created February 22, 2014 17:38
Show Gist options
  • Save kaz-tk/9158720 to your computer and use it in GitHub Desktop.
Save kaz-tk/9158720 to your computer and use it in GitHub Desktop.
# python 2.7.3
char_array = [
['.','@','-','_','/',':','~','1'],
['a','b','c','A','B','C','2'],
['d','e','f','D','E','F','3'],
['g','h','i','G','H','I','4'],
['j','k','l','J','K','L','5'],
['m','n','o','M','N','O','6'],
['p','q','r','s','P','Q','R','S','7'],
['t','u','v','T','U','V','8'],
['w','x','y','z','W','X','Y','Z','9'],
]
line = raw_input()
old = int(line[0])
count = 0
output = ''
for letter in line[1:]:
if old =='E':
old = int(letter)
count = 0
continue
elif letter == 'E':
output = output+ char_array[old-1][count]
old=letter
continue
letter = int(letter)
if (old != letter):
output = output+ char_array[old-1][count]
old = letter
count =0
pass
else:
count = count +1
count = count % (len(char_array[old-1]))
pass
pass
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment