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<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

string b[] = {
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz",
};

int main() {
	int n; cin >> n; cin.ignore();
	for (int i = 0; i < n; i++) {
		string s; getline(cin, s);
		int cnt = -1;
		for (int j = 0; j < s.size(); j++) {
			if (s[j] != '0')cnt++;
			else if (cnt != -1) {
				printf("%c", b[s[j - 1] - '0'][cnt%b[s[j - 1] - '0'].size()]);
				cnt = -1;
			}
		}
		printf("\n");
	}
	return 0;
}

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

int main(){
    int N;
    char c;
    char alpha[10]={'.','.','a','d','g','j','m','p','t','w'};
    char alpha1[5]={' ','.',',','!','?'};
    cin>>N;
    getchar();
    while(N--){
        int cnt=0,before,now=0;
        while(c=getchar(),c!='\n'){
            before = now;
            now = c-'0';
            //printf("before=%d , now=%d\n",before,now);
            if(now!=0)cnt++;
            else if(before==1){
                printf("%c",alpha1[cnt%5]);
                cnt=0;
            }else if(before!=0){
                printf("%c",alpha[before]+(cnt-1)%(before==7||before==9 ? 4 : 3));
                cnt=0;
            }
        }
        cout<<endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;
int main(void){

    char str[10][100] = {
    {""},
    {".,!? "},
    {"abc"},
    {"def"},
    {"ghi"},
    {"jkl"},
    {"mno"},
    {"pqrs"},
    {"tuv"},
    {"wxyz"}
    };

    int n; scanf("%d",&n);
    for(int i = 0;i < n;i++){
        char in[10000];
        scanf("%s",in);
        int cnt = -1;
        for(int i = 0;i < strlen(in);i++){
            if(in[i] == '0'){
                if(cnt == -1) continue;

                if(in[i-1] == '1'){
                    cnt %= 5;
                }
                else if(in[i-1] == '9'){
                    cnt %= 6;
                }
                else{
                    cnt %= 3;
                }

                printf("%c",str[in[i-1]-'0'][cnt]);
                cnt = -1;
            }
            else cnt++;
        }
        printf("\n");
    }

    return 0;
}