Go: package main

import (
	"bytes"
	"fmt"
)

//Ktai has a keyboard and a state.
type Ktai struct {
	keyboard KeyBoard
	textBuf  *bytes.Buffer
}

// KeyBoard is type of a map.
type KeyBoard map[rune]string

// KEYBOARD that Ktai has
var KEYBOARD = KeyBoard{
	'0': "",
	'1': ".,!? ",
	'2': "abc",
	'3': "def",
	'4': "ghi",
	'5': "jkl",
	'6': "mno",
	'7': "pqrs",
	'8': "tuv",
	'9': "wxyz",
}

func main() {
	var N int
	fmt.Scanf("%d", &N)
	ktai := &Ktai{
		KEYBOARD, &bytes.Buffer{},
	}
	for i := 0; i < N; i++ {
		var numstr string
		fmt.Scanf("%s", &numstr)
		ktai.feed(numstr)
		ktai.print()
	}
}

func (ktai *Ktai) feed(str string) {
	var char *byte
	for _, v := range str {
		if v == '0' {
			if char != nil {
				ktai.textBuf.WriteByte(*char)
				char = nil
			}
			continue
		} else {
			runestring := ktai.keyboard[v]
			idx := ktai.indexOf(char, runestring)
			next := (idx + 1) % len(runestring)
			c := runestring[next]
			char = &c
		}
	}
}

func (ktai *Ktai) indexOf(ch *byte, str string) int {
	if ch == nil {
		return -1
	}
	r := rune(*ch)
	idx := -1
	for i, v := range str {
		if r == v {
			idx = i
			break
		}
	}
	return idx
}

func (ktai *Ktai) print() {
	fmt.Println(ktai.textBuf.String())
	ktai.textBuf.Reset()
}

Python: a = ["" for i in range(10)]
a[1] = ".,!? "
a[2] = "abc"
a[3] = "def"
a[4] = "ghi"
a[5] = "jkl"
a[6] = "mno"
a[7] = "pqrs"
a[8] = "tuv"
a[9] = "wxyz"
num = int(input())
for count in range(num):
    s = input()
    b = ""
    c = '0'
    d = 0
    for i in s:
        if i=='0' :
            if c=='0': continue
            if c == '1':
                b += a[int(c)][d%5]
            elif c in "79":
                b += a[int(c)][d%4]
            else :
                b += a[int(c)][d%3]
            c = '0'
            d = 0
        if(c!=i):
            c = i
            d = 0
        else :
            d += 1
    print(b)

Python: a=[['.',',','!','?',' '],['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 _ in range(int(input())):
    b=list(filter(lambda x: x!='',input().split('0')))
    for c in b:
        d=int(c[0])-1
        print(a[d][(len(c)-1)%len(a[d])],end='')
    print()

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 == 7 or a_0 == 9:
        
                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: s = [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']]
for _ in range(int(input())):
    l = list(filter(lambda x: x!='', input().split('0')))
    r = ''
    for d in l:
        i,j = int(d[0]),len(d)-1
        r += s[i][j%len(s[i])]
    print(r)

Python: import sys

litter = [""]
litter.append(list(" .,!? "))
litter.append(list(" abc"))
litter.append(list(" def"))
litter.append(list(" ghi"))
litter.append(list(" jkl"))
litter.append(list(" mno"))
litter.append(list(" pqrs"))
litter.append(list(" tuv"))
litter.append(list(" wxyz"))

n = input()
for count in range(n):
    ls = map(int, list(raw_input()))
    button, times = None, 0
    for i in ls:
        if i==0 :
            if button != None:
                sys.stdout.write(litter[button][times])
                button, times = None, 0
        else:
            button, times = i, times+1
            if times == len(litter[button]):
                times = 1
    sys.stdout.write('\n')

Python: keylist = [
   [],
   ['.', ',', '!', '?', ' '],
   ['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(int(input())):
   output = ''
   for item in input().split('0'):
      if item == '':
         continue
      output += keylist[int(item[0])][len(item) % len(keylist[int(item[0])]) - 1]
   print(output)

Python: dats=[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']]
for p in range(input()):
    a=raw_input().split('0')
    b=""
    for i in range(len(a)):
        if a[i]!="":
            c=a[i]
            b=b+dats[int(c[0])][len(c)%len(dats[int(c[0])])-1]
    print(b)

Python: def set(mess) :
  Mess = list(mess.split("0"))
  Ml = len(Mess)
  for i in range(Ml) :
    if("" in Mess) :
      Mess.remove("")
      # Mess 内の1番インデックスの小さい""を削除
    else :
      break
  ML = len(Mess)
  change(Mess, ML)

def change(Mess, ML) :
  one = [".", ",", "!", "?", " "]
  alpha = [chr(i) for i in range(97, 97 + 26)]

  Num = list()
  Cnt = list()
  for i in range(ML) :
    a = list(Mess[i])
    Num.append(a[0])
    Cnt.append(len(a))

  ans = list()
  for i in range(ML) :
    if(Num[i] == "1") :
      ans.append(one[Cnt[i] % 5 - 1])
    elif(Num[i] == "7") :
      ans.append(alpha[(Cnt[i]-1)% 4 + 15])
    elif(Num[i] == "8") :
      ans.append(alpha[(Cnt[i]-1)% 3 + 19])
    elif(Num[i] == "9") :
      ans.append(alpha[(Cnt[i]-1)% 4 + 22])
    else :
      x = 3 * (int(Num[i]) - 2)
      ans.append(alpha[(Cnt[i]-1) % 3 + x])

  for j in range(len(ans)) :
    if(j == len(ans) - 1) :
      print(ans[j])
    else :
      print(ans[j], end = "")

N = int(input())
for i in range(N) :
  mess = input()

  set(mess)

Python: dic = [None, '.,!? ','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']

N = int(input())
for i in range(N):
    S = input()
    ans = ''
    btn = n = -1
    for c in S:
        if c == '0':
            if btn > 0:
                ans += dic[int(btn)][n % len(dic[int(btn)])]
                btn = n = -1
        else:
            btn = int(c)
            n += 1
    print(ans)

Python: import itertools

table = {	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()
	r = ''
	for k, g in itertools.groupby(s):
		if k == '0':
			continue
		k = int(k)
		i = (len(list(g)) - 1) % len(table[k])
		r += table[k][i]
	print(r)

Python: char = ["",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]
n = int(input())

for _ in range(n):
    s = input()
    ans = ""
    flag = True
    prev = 0
    cnt = 0
    for i in s:
        if i != '0':
            prev = int(i)
            cnt += 1
        elif cnt != 0:
            ans += char[prev][(cnt - 1) % len(char[prev])]
            cnt = 0
    print(ans)

Python: button = [0, ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]

n = int(input())
for i in range(n):
    s = input()

    cnt = 0
    key = "0"

    for c in s:
        if c != "0":
            cnt += 1
            key = c
        else:
            if key == "0":
                cnt = 0
                continue
            else:
                print(button[int(key)][(cnt - 1) % len(button[int(key)])], end = "")
                cnt = 0
                key = "0"

    print()