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: d={'7': ['p', 'q', 'r', 's'], '2': ['a', 'b', 'c'], '1': ['.', ',', '!', '?'," "], '3': ['d', 'e', 'f'], '9': ['w', 'x', 'y', 'z'], '5': ['j', 'k', 'l'], '8': ['t', 'u', 'v'], '4': ['g', 'h', 'i'], '6': ['m', 'n', 'o']}
time=int(input())
for i in range (time):
    answer=[]
    word=input().split("0")
    while "" in word: word.remove("")
    for i in word:
        answer.append(d[i[0]][len(i)%len(d[i[0]])-1])
    print("".join(answer))

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()