Go: // Keitai Message
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2006&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var table = []string{
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz",
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)

	for i := 0; i < n; i++ {
		message := nextString(sc)
		currentButton, count := 0, 0
		for _, word := range message {
			// 確定の処理を書く
			if word == '0' {
				if currentButton == 0 {
					count = 0
					continue
				}
				mod := len(table[currentButton])
				tmp := table[currentButton][(count-1)%mod]
				currentButton, count = 0, 0
				fmt.Printf("%c", tmp)
			} else {
				count++
				currentButton = int(word) - 48 // '0'はASCIIで48
			}
		}
		fmt.Println()
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

Python: def solve(mm, cmd):
	bf = cmd[0]
	c = 0
	ans = ""
	for s in cmd[1::]:
			if bf == s:
				c += 1
			else:
				if s == '0':
					ans += mm[bf][c%len(mm[bf])]
				c = 0
				bf = s
	return ans

def main():
	N = int(input())
	cc = [
		[".",",","!","?"," "],
		["a","b","c"],
		["d","e","f"],
		["g","h","i"],
		["j","k","l"],
		["m","n","o"],
		["p","q","r","s"],
		["t","u","v"],
		["w","x","y","z"]]
	mm = dict(zip(
		[str(i) for i in range(1,10)],
		cc
	))
	print(mm)
	for _ in range(N):
		cmd = input()
		print(solve(mm,cmd))

if __name__ == '__main__':
	main()

Python: # Keitai Message

ans = []

words = [0, [".", ",", "!", "?", " "]
        , ["a", "b", "c"]
        , ["d", "e", "f"]
        , ["g", "h", "i"]
        , ["j", "k", "l"]
        , ["m", "n", "o"]
        , ["p", "q", "r", "s"]
        , ["t", "u", "v"]
        , ["w", "x", "y", "z"]
        ]

n = int(input())
for j in range(n):
    a = list(input())
    tips = []
    cnt = 1
    ansT = ""
    for i in range(1, len(a)):
        if a[i] == a[i-1]:
            cnt += 1
        else:
            tips.append([int(a[i-1]), cnt])
            cnt = 1
    tips.append([int(a[-1]), cnt])

    for i in tips:
        if i[0] == 0:
            pass
        else:
            ansT += words[i[0]][i[1] % len(words[i[0]]) - 1]

    ans.append(ansT)

for i in ans:
    print(i)

Python: N = int(input())
d = []
d.append([])
d.append([".",",","!","?"])
d.append(["a","b","c"])
d.append(["d","e","f"])
d.append(["g","h","i"])
d.append(["j","k","l"])
d.append(["m","n","o"])
d.append(["p","q","r","s"])
d.append(["t","u","v"])
d.append(["w","x","y","z"])
for _ in range(N):
    nn = input()
    output = ""
    b = 0
    c = 0
    for n in nn:
        n = int(n)
        if n == 0:
            output += d[b][c]
            c = 0
        c += 1
    print(output)

Python: tel_dict = {
        1 : (".", ",", "!", "?", " "),
        2 : ("a", "b", "c"),
        3 : ("d", "e", "f"),
        4 : ("g", "h", "i"),
        5 : ("j", "k", "l"),
        6 : ("m", "n", "o"),
        7 : ("p", "q", "r", "s"),
        8 : ("t", "u", "v"),
        9 : ("w", "x", "y", "z"),
        }
def get_input():
    input_data = input()
    return input_data

def convert_num_to_word(num_str):
    count = 0
    c_list = list()
    for i in num_str:
        if i != "0":
            num_state = int(i)
            count += 1
        else:
            if count == 0:
                continue
            order = (count - 1) % len(tel_dict[num_state])
            # print("order", order) # debug
            c = tel_dict[num_state][order]
            c_list.append(c)
            count = 0 # reset
    return c_list




if __name__ == "__main__":
    input_data = int(get_input())
    for i in range(input_data):
        input_data = get_input()
        c_list = convert_num_to_word(input_data)
        word = "".join(c_list)
        print(word)

Python: dic={
    '1':'.,!? ',
    '2':'abc',
    '3':'def',
    '4':'ghi',
    '5':'jkl',
    '6':'mno',
    '7':'pqrs',
    '8':'tuv',
    '9':'wxyz'
}

for i in range(int(input())):
    s=input().split('0')
    for c in s:
        if c=='':
            continue
        print(dic[c[0]][(len(c)-1)%len(dic[c[0]])],end='')
    print()

Python: def solve(mm, cmd):
	bf = cmd[0]
	c = 0
	ans = ""
	for s in cmd[1::]:
			if bf == s:
				c += 1
			else:
				if s == '0':
					ans += mm[bf][c%len(mm[bf])]
				c = 0
				bf = s
	return ans

def main():
	N = int(input())
	cc = [
		[".",",","!","?"," "],
		["a","b","c"],
		["d","e","f"],
		["g","h","i"],
		["j","k","l"],
		["m","n","o"],
		["p","q","r","s"],
		["t","u","v"],
		["w","x","y","z"]]
	mm = dict(zip(
		[str(i) for i in range(1,10)],
		cc
	))
	for _ in range(N):
		cmd = input()
		print(solve(mm,cmd))

if __name__ == '__main__':
	main()

Python: 
N=int(input())

button=[[],
        ['.',',','!','?'," "],
        ['a','b','c'],
        ['d','e','f'],
        ['g','h','i'],
        ['j','k','l'],
        ['m','n','o'],
        ['p','q','r','s'],
        ['t','u','v'],
        ['w','x','y','z'],
        ]


for i in range(N):
    S=str(input())
    S=[i + " " for i in S]
    moji=""
    for i in S:
        moji+=i
    S=list(map(int,moji.split()))
    #print(S)
    forward=[0,0]
    for i in S:
        if forward[0]==i and forward[0]!=0:
            forward[1]+=1
            if forward[1]>len(button[i])-1:
                forward[1]=0

        if i==0 and forward!=[0,0]:
            print(button[forward[0]][forward[1]],end="")
            forward[1]=0
        forward[0]=i
        #print(forward)
    print("\n",end="")

Python: def moji(x,ans):
    if ans == 0:
        return
    if x == 1:
        if(ans%4==1):
            str = '.'
        elif(ans%4==2):
            str =','
        elif(ans%4==3):
            str='!'
        else:
            str = '?'
    if x == 2:
        if(ans%3==1):
            str = 'a'
        elif(ans%3==2):
            str = 'b'
        else:
            str = 'c'
    if x == 3:
        if(ans%3==1):
            str = 'd'
        elif(ans%3==2):
            str = 'e'
        else:
            str = 'f'
    if x == 4:
        if(ans%3==1):
            str = 'g'
        elif(ans%3==2):
            str = 'h'
        else:
            str = 'i'
    if x == 5:
        if(ans%3==1):
            str = 'j'
        elif(ans%3==2):
            str = 'k'
        else:
            str = 'l'
    if x == 6:
        if(ans%3==1):
            str = 'm'
        elif(ans%3==2):
            str = 'n'
        else:
            str = 'o'
    if x == 7:
        if(ans%4==1):
            str = 'p'
        elif(ans%4==2):
            str = 'q'
        elif(ans%4==3):
            str ='r'
        else:
            str = 's'
    if x == 8:
        if(ans%3==1):
            str = 't'
        elif(ans%3==2):
            str = 'u'
        else:
            str = 'v'
    if x == 9:
        if(ans%4==1):
            str = 'w'
        elif(ans%4==2):
            str = 'x'
        elif ans%4==3:
            str = 'y'
        else:
            str = 'z'
    print(str,end="")
def solve(str):
    x = '-1'
    ans =0
    for s in str:
        if s == '0':
            moji(int(x),ans)
            ans = 0
        else:
            x = s
            ans +=1

N = int(input())
for i in range(N):
    solve(input())
    print()