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: import sys
K = '.,!? '
A = 'abc'
D = 'def'
G = 'ghi'
J = 'jkl'
M = 'mno'
P = 'pqrs'
T = 'tuv'
W = 'wxyz'
L = ['', K, A, D, G, J, M, P, T, W]
count = int(input())
while count:
	count -= 1
	S = []
	n = input()
	if not '0' in n:
		print('')
		continue
	else:
		n = n.split('0')
		for ns in n:
			if ns == '':
				continue
			i = len(ns) % len(L[int(ns[0])])
			S += [[L[int(ns[0])], i-1]]
		for s in S:
			print(s[0][s[1]], end='')
		print('')
		continue

Python: from itertools import cycle as c

n=int(input())
for _ in range(n):
    tt=input()
    l=[]
    t=""
    for (i,j) in enumerate(tt):
        ct=int(j)
        if ct==0 or i==0:
            if i!=0:
                l.extend([t])
                t=""
            kk=[c([".",",","!","?"," "]),
                c(["a","b","c"]),
                c(["d","e","f"]),
                c(["g","h","i"]),
                c(["j","k","l"]),
                c(["m","n","o"]),
                c(["p","q","r","s"]),
                c(["t","u","v"]),
                c(["w","x","y","z"])]
        if ct!=0 :
            t=kk[ct-1].next()
    print("".join(l))

Python: def moji(x,ans):
    if ans == 0:
        return
    if x == 1:
        if(ans%5==1):
            str = '.'
        elif(ans%5==2):
            str =','
        elif(ans%5==3):
            str='!'
        elif ans%5==4:
            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()

Python: #!/usr/bin/python3

def atoi(c):
    return ord(c) - ord('0')

table = [(), #dummy
        ('.',',','!','?'),\
        ('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 i in range(n):
    digits = list(input())
    s = ""
    c = ''
    m = 0
    for d in digits:
        if d == '0':
            s += c
            c = ''
            m = 0
        else:
            c = table[atoi(d)][m]
            m = (m + 1) % len(table[atoi(d)])
    print(s)

Python: moji_lis = [[".",",","!","?"," "],["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 i in range(n):
    N_lis = list(input())
    N_lis = list(map(int,N_lis))
    
    a_0 = N_lis[0]
    n_num = 1
    moji = ""
    for j in range(1,len(N_lis)):

        a_1 = N_lis[j]
        
        if a_0 == a_1:
            n_num += 1
        else:
            if a_0 == 1:
                moji += moji_lis[0][(n_num - 1) % 5]
                
            elif a_0 == 6 or a_0 == 8:
                moji += moji_lis[a_0 - 1][(n_num - 1) % 4]
                
            elif a_0 != 0:
                moji += moji_lis[a_0 - 1][(n_num - 1) % 3]
                
        a_0 = a_1
        if a_1 == 0:
            n_num = 1
    print(moji)

Python: #!/usr/bin/env python
# -*- coding: utf-8 -*-

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']]

n = int(input())
for i in range(n):
    inputStr = list(map(int,list(input())))
    count = 0
    for j in range(len(inputStr)):
        if inputStr[j] != 0:
            count += 1
        if inputStr[j] == 0 and j -1 >= 0 and  inputStr[j-1] != 0:
            print(button[inputStr[j-1]][(count-1)%len(button[inputStr[j-1]])],end='')
            count = 0
    print()

Python: 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"],
]

N = int(input())
for _ in range(N):
    S = ""
    count = 0
    l = list(input())
    for i in range(0, len(l)):
        if l[i] == "0":
            S += button[int(l[i - 1])][count-1]
            count = 0
        else:
            # print(l[i])
            count = (count + 1) % len(button[int(l[i])])
    print(S)

Python: alpha = [[], list(".,!? "), list("abc"), list("def"), list("ghi"),
         list("jkl"), list("mno"), list("pqrs"), list("tuv"), list("wxyz")]

n = int(input())
for _ in range(n):
    button = list(input())
    button = [int(b) for b in button]

    while 1:
        if button[0] == 0:
            button.pop(0)
        else:
            break

    ans = ""
    cnt = 0
    for i, b in enumerate(button):
        if b == 0 and button[i-1] != 0:
            ans += alpha[button[i-1]][(cnt-1) % len(alpha[button[i-1]])]
            cnt = 0
        elif b == 0:
            pass
        else:
            cnt += 1

    print(ans)

Python: K = '.,!? '
A = 'abc'
D = 'def'
G = 'ghi'
J = 'jkl'
M = 'mno'
P = 'pqrs'
T = 'tuv'
W = 'wxyz'
L = ['', K, A, D, G, J, M, P, T, W]


while 1:
	S = []
	n = input()
	if not '0' in n:
		print('')
	else:
		n = n.split('0')
		for ns in n:
			if ns == '':
				continue
			i = len(ns) % len(L[int(ns[0])])
			S += [[L[int(ns[0])], i-1]]
		for s in S:
			print(s[0][s[1]], end='')
		print('')