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: phone = [[], [".", ",", "!", "?", " "], ["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) :
    message = list(input().split("0"))
    for j in range(len(message)) :
        if message[j] != "" :
            push = list(message[j])
            num = int(push[0])
            kaisuu = len(push) % len(phone[num])
            if kaisuu == 0 :
                print(phone[num][-1], end="")
            else :
                print(phone[num][kaisuu-1], end="")
    print()

Python: d=[1,'.,!? ','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz'];[print(''.join(d[int(s[0])][len(s)%len(d[int(s[0])])-1]if s!=''else''for s in t))for t in[input().split('0')for _ in[0]*int(input())]]

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: 
keymap = [
    [".",",","!","?"," "],
    ["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):
    keys = str(input())
    message = ""
    currentChar = ""
    currentKey = "X"
    push_counter = 0
    for key in keys:
        if key == "0":
            message += currentChar
            currentChar = ""
            currentKey = "0"
            continue
        if currentKey == key:
            push_counter += 1
        else:
            push_counter = 0
            currentKey = key
        key_int = int(currentKey) - 1
        count = push_counter % len(keymap[key_int])
        currentChar = keymap[key_int][count]
    print(message)

Python: n=int(input())
k=[[],[".",",","!","?"," "],["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):
  b=input()
  #print(b)
  S=[]
  count=0
  for i in range(len(b)):
    if b[i]=="0":
      if count==0:
        pass
      else:
        if b[i-1]=="1":
          co=count%5-1
          S.append(k[1][co])
          count=0
        elif b[i-1]=="2":
          co=count%3-1
          S.append(k[2][co])
          count=0
        elif b[i-1]=="3":
          co=count%3-1
          S.append(k[3][co])
          count=0
        elif b[i-1]=="4":
          co=count%3-1
          S.append(k[4][co])
          count=0
        elif b[i-1]=="5":
          co=count%3-1
          S.append(k[5][co])
          count=0
        if b[i-1]=="6":
          co=count%3-1
          S.append(k[6][co])
          count=0
        if b[i-1]=="7":
          co=count%4-1
          S.append(k[7][co])
          count=0
        if b[i-1]=="8":
          co=count%3-1
          S.append(k[8][co])
          count=0
        if b[i-1]=="9":
          co=count%4-1
          S.append(k[9][co])
          count=0
    else:
      count+=1
    
  for i in range(len(S)):
    print(S[i],end="")
  print("")

Python: import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**3
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []
    n = I()
    a = [S() for _ in range(n)]
    d = {}
    d[1] = '.,!? '
    d[2] = 'abc'
    d[3] = 'def'
    d[4] = 'ghi'
    d[5] = 'jkl'
    d[6] = 'mno'
    d[7] = 'pqrs'
    d[8] = 'tuv'
    d[9] = 'wxyz'
    for s in a:
        r = ''
        i = -1
        c = 0
        for t in s:
            tc = int(t)
            if tc == 0:
                if c > 0:
                    r += d[c][i%len(d[c])]
                i = -1
                c = 0
            else:
                c = tc
                i += 1
        rr.append(r)

    return '\n'.join(map(str, rr))


print(main())

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

def solve_testcase():
    s = input().split('0')
    res = ''
    for s0 in s:
        if not s0: continue
        c = s0[0]
        v = keys[c]
        res += v[(len(s0)-1) % len(v)]

    print(res)

def main():
    n = int(input())
    for _ in range(n): solve_testcase()

main()

Python: n = int(input())
string = ["", ".,!?", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]
for i in range(n):
    s = input()
    count = 0
    num = int(s[0])
    for c, c1 in zip(s, s[1:]):
        if c == c1:
            count += 1
        else:
            if num != 0:
                print(string[num][count % len(string[num])], end="")
            else:
                pass
            num = int(c1)
            count = 0
    print()

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

n = int(input())
for _ in range(n):
    s = input()
    i = None
    cnt = 0
    ans = ''
    for si in list(s):
        sii = int(si)
        if sii == 0:
            if i is not None:
                ans += codes[i][cnt % len(codes[i])]
            i = None
        else:
            if i != sii:
                i = sii
                cnt = 0
            else:
                cnt += 1
    print(ans)

Python: w = [[''],['.',',','!','?',' '], ['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):
    buff = ''
    s = input()
    push = 0
    times = 0
    for c in s:
        if int(c) == 0:
            buff += w[push][times%len(w[push])]
        if int(c) == push:
            times += 1
        else:
            push = int(c)
            times = 0
    print(buff)