call me maby solution

This commit is contained in:
Stephen McQuay 2012-09-08 10:19:24 -06:00
commit cf17dc32c9
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import sys
mebi_mapping = {
0: '0',
1: '1',
2: 'ABC',
3: 'DEF',
4: 'GHI',
5: 'JKL',
6: 'MNO',
7: 'PQRS',
8: 'TUV',
9: 'WXYZ',
}
lookup = {}
for k, v in mebi_mapping.iteritems():
for c in v:
lookup[c.lower()] = str(k)
lookup[str(k)] = str(k)
for line in sys.stdin:
number = ''
for c in line.strip():
number += lookup[c.lower()]
print number

3
call-me-maybe/stdin1.txt Normal file
View File

@ -0,0 +1,3 @@
5551234
GOPANDA
MebiPenny2012