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

C++: #include <iostream>
#include <string>
using namespace std;
typedef long long int lli;

string charset[10][5] = {
	{},
	{".", ",", "!", "?", " "},
	{"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"}
};
int loop[10] = {0, 5, 3, 3, 3, 3, 3, 4, 3, 4};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	for (int n = 0; n < N; n++){
		string s;
		cin >> s;

		int i = 0;
		int push = -1;
		string ans = "";
		while (i < s.length()){
			int num = stoi(s.substr(i, 1));
			if (num != 0){
				int thisnum = num;
				while (num != 0){
					push++;
					i++;
					num = stoi(s.substr(i, 1));
				}
				ans += charset[thisnum][push % loop[thisnum]];
				push = -1;
			}
			i++;
		}
		cout << ans << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <cstdlib>

using namespace std;

char num1[5]={'.', ',', '!', '?', ' '};
char num2[]="abc", num3[]="def", num4[]="ghi", num5[]="jkl", num6[]="mno", num7[]="pqrs", num8[]="tuv", num9[]="wxyz";

char func(int x, int y);

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int c1, c2=-1, c3=0;
		char c;
		c1 = getchar();
		while(1){
			c1 = getchar();
			if(c1 == '\n'){
				cout << endl;
				c3 = 0;
				break;
			} else if(c1 == '0'){
				if(c2 != -1){
					c = func(c2, c3);
					cout << c;
					c3 = 0;
				}
			} else {
				if(c1 == c2) c3++;
				else {
					c1 = c1 - '0';
					c2 = c1;
					c3++;
				}
			}
		}
	}
	return 0;
}

char func(int x, int y)
{
	int z;
	if(x == 1) return num1[(y-1)%5];
	else if(x == 2) return num2[(y-1)%3];
	else if(x == 3) return num3[(y-1)%3];
	else if(x == 4) return num4[(y-1)%3];
	else if(x == 5) return num5[(y-1)%3];
	else if(x == 6) return num6[(y-1)%3];
	else if(x == 7) return num7[(y-1)%4];
	else if(x == 8) return num8[(y-1)%3];
	else return num9[(y-1)%4];
}

C++: #include <bits/stdc++.h>
using namespace std;

char trans(char num, int i){
    if(num == '1'){
        if(i % 4 == 1) return '.';
        else if(i % 4 == 2) return ',';
        else if(i % 4 == 3) return '!';
        else if(i % 4 == 0) return '?';
    }
    if(num == '2'){
        if(i % 3 == 1) return 'a';
        else if(i % 3 == 2) return 'b';
        else if(i % 3 == 0) return 'c';
    }
    if(num == '3'){
        if(i % 3 == 1) return 'd';
        else if(i % 3 == 2) return 'e';
        else if(i % 3 == 0) return 'f';
    }
    if(num == '4'){
        if(i % 3 == 1) return 'g';
        else if(i % 3 == 2) return 'h';
        else if(i % 3 == 0) return 'i';
    }
    if(num == '5'){
        if(i % 3 == 1) return 'j';
        else if(i % 3 == 2) return 'k';
        else if(i % 3 == 0) return 'l';
    }
    if(num == '6'){
        if(i % 3 == 1) return 'm';
        else if(i % 3 == 2) return 'n';
        else if(i % 3 == 0) return 'o';
    }
    if(num == '7'){
        if(i % 4 == 1) return 'p';
        else if(i % 4 == 2) return 'q';
        else if(i % 4 == 3) return 'r';
        else if(i % 4 == 0) return 's';
    }
    if(num == '8'){
        if(i % 3 == 1) return 't';
        else if(i % 3 == 2) return 'u';
        else if(i % 3 == 0) return 'v';
    }
    if(num == '9'){
        if(i % 4 == 1) return 'w';
        else if(i % 4 == 2) return 'x';
        else if(i % 4 == 3) return 'y';
        else if(i % 4 == 0) return 'z';
    }
    return '0';
}

int main(){
    int n;
    cin >> n;
    string s;

    for(int i = 0; i < n; i++){
        cin >> s;
        for(int j = 0; j < (int)s.size(); j++){
            int cnt = 0;
            if(s[j] == '0'){
                if(s[j-1] != '0'){
                    int k = j - 1;
                    cnt = 1;
                    while(s[k] == s[k - 1]){
                        cnt++;
                        k--;
                    }
                }
                cout << trans(s[j-1], cnt);
            }
        }
        cout << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)

const char *keitai[] = {
    "",
    ".,!? ",
    "abc",
    "def",
    "ghi",
    "jkl",
    "mno",
    "pqrs",
    "tuv",
    "wxyz"
};

int main(){
    int T,i;
    string in;

    cin >> T;
    while( T-- ){
        cin >> in;

        int cnt = 0, num = -1;
        rep(i,in.length()){
            if( in[i] == '0' ){
                if( num != -1 ){
                    putchar(keitai[num][(cnt-1)%strlen(keitai[num])]);
                }
                cnt = 0, num = -1;
            }
            else{
                num = in[i] - '0';
                cnt++;
            }
        }
        puts("");
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

string order;
vector<int> num;
vector<char> word;
int n;
char button[9][5] = {{'.',',','!','?', ' '},{'a','b','c'},{'d','e','f'},{'g','h','i'},{'i','k','l'},{'m','n','o'},{'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};

int main()
{
  int but = 0,push = 0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> order;
    for(int j=0;j<order.size();j++){
      num.push_back((int)(order[j]-'0'));
    }
    for(int j=0;j<num.size();j++){
      if(1<=num[j] && num[j]<=9){
	if(but==0){
	  but = num[j];
	}else{
	  push++;
	}
      }else if(num[j]==0){
	if(but==0){
	  continue;
	}
	
	const int mod = (but == 1 ? 5 : but == 7 || but == 9 ? 4 : 3);

	word.push_back(button[but-1][push%mod]); //cout << button[but-1][push%3] << endl;
	push = 0;
	but = 0;
      }
    }
    
    for(int k=0;k<word.size();k++){
      cout << word[k];
    }
    cout << endl;
    
    word.clear();
    num.clear();
  }
  
  return 0;
  
}