Skip to content

Instantly share code, notes, and snippets.

@Quby
Created November 26, 2011 05:32
Show Gist options
  • Save Quby/1395095 to your computer and use it in GitHub Desktop.
Save Quby/1395095 to your computer and use it in GitHub Desktop.
keyboard = {}
keys = "oqz,ij,abc,def,gh,kl,mn,prs,tuv,wxy".split(",")
k = 0
for x in keys:
for c in x:
keyboard[c] = k
k = k + 1
def toNumbers(x):
return [keyboard[c] for c in x]
def extract (number, words, nwords):
pass
input = open("input.txt", "r")
output = open("output.txt", "w")
while (True):
number = input.readline()
if number == "-1" : break
words = [input.readline() for x in range(1, int(input.readline()))]
nwords = [toNumbers(x) for x in words]
output.writeline(extract(number, words, nwords))
output.close()
input.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment