call me maby solution
This commit is contained in:
commit
cf17dc32c9
27
call-me-maybe/call_me_maybe.py
Normal file
27
call-me-maybe/call_me_maybe.py
Normal 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
3
call-me-maybe/stdin1.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
5551234
|
||||||
|
GOPANDA
|
||||||
|
MebiPenny2012
|
Loading…
Reference in New Issue
Block a user