Problem: Solve The Mystery

Input:
First line contains T - number of test cases.
Following T lines each contains a string of characters in the range [a-z] only  

Output:
Print a numeric string for each test case.  

Constraints:
1 ≤ T ≤ 100
1 ≤ Length of String ≤ 100  

SAMPLE INPUT
10
key
to
control
nine
tails
is
in
your
hand
phone

SAMPLE OUTPUT
539
86
2668765
6463
82457
47
46
9687
4263
74663

Solution (in PYTHON):

Solution:
import string
def cal(p):
    a=['a','b','c']
    b=['d','e','f']
    c=['g','h','i']
    d=['j','k','l']
    e=['m','n','o']
    f=['p','q','r','s']
    g=['t','u','v']
    h=['w','x','y','z']
    for i in range(0,len(p)):
        if p[i] in a:
            p=p.replace(p[i],'2')
        if p[i] in b:
            p=p.replace(p[i],'3')
        if p[i] in c:
            p=p.replace(p[i],'4')
        if p[i] in d:
            p=p.replace(p[i],'5')
        if p[i] in e:
            p=p.replace(p[i],'6')
        if p[i] in f:
            p=p.replace(p[i],'7')
        if p[i] in g:
            p=p.replace(p[i],'8')
        if p[i] in h:
            p=p.replace(p[i],'9')
    print p    
k=input()

for i in range(0,k):
    p=raw_input()
    b=cal(p)