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 "bits/stdc++.h"
using namespace std;

char c1[] = { ' ', '.', ',', '!', '?', };
char c2[] = { 'c', 'a', 'b', };
char c3[] = { 'f', 'd', 'e', };
char c4[] = { 'i', 'g', 'h', };
char c5[] = { 'l', 'j', 'k', };
char c6[] = { 'o', 'm', 'n', };
char c7[] = { 's', 'p', 'q', 'r', };
char c8[] = { 'v', 't', 'u', };
char c9[] = { 'z', 'w', 'x', 'y', };

char get_c(char a, int cnt) {
        if (a == '1') return c1[cnt % 5];
        if (a == '2') return c2[cnt % 3];
        if (a == '3') return c3[cnt % 3];
        if (a == '4') return c4[cnt % 3];
        if (a == '5') return c5[cnt % 3];
        if (a == '6') return c6[cnt % 3];
        if (a == '7') return c7[cnt % 4];
        if (a == '8') return c8[cnt % 3];
        if (a == '9') return c9[cnt % 4];
        return 0;
}

int main() {
        int n;
        cin >> n;
        while (n --) {
                string s;
                cin >> s;
                bool doing = false;
                int cnt = 0;
                char now;
                for (int i = 0; i < s.size(); i ++) {
                        if (s[i] != '0') {
                                doing = true;
                                cnt ++;
                                now = s[i];
                        } else {
                                if (!doing) continue;
                                else {
                                        cout << get_c(now, cnt);
                                }
                                doing = false;
                                cnt = 0;
                        }
                }
                cout << endl;
        }
        return 0;
}

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

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

string convert(string s) {
    if (s == "") return "";
    int i = s[0] - '0';
    int j = s.size() - 1;
    return string(1, table[i][j % (int)table[i].size()]);
}

int main() {
    int T;
    cin >> T;
    while (T--) {
        string s;
        cin >> s;
        string ans = "", t = "";
        for (int i=0; i<(int)s.size(); ++i) {
            if (s[i] == '0') {
                ans += convert(t);
                t = "";
            } else {
                t += s[i];
            }
        }
        cout << ans << endl;
    }
}

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

char const mozi1[]={'.',',','!','?',' '},mozi2[]={'a','b','c'},mozi3[]={'d','e','f'},mozi4[]={'g','h','i'},mozi5[]={'j','k','l'},mozi6[]={'m','n','o'},mozi7[]={'p','q','r','s'},mozi8[]={'t','u','v'},mozi9[]={'w','x','y','z'};
void henkan(char *);
char mozi(int,char);
int main(){
	int n;
	cin>>n;

	for(int i=0;i<n;i++){
		char * keitai=new char[1024];
		scanf("%s",keitai);
		henkan(keitai);
		delete[]keitai;
	}
	return 0;
}

void henkan(char * keitai){
	char *hyouzi=new char[72];
	fill(hyouzi,hyouzi+72,0);
	int length=strlen(keitai);
	int cnt=0;
	
	for(int i=0;i<length;i++){
		if(keitai[i]=='0')	continue;
		else{
			int kazu=1;
			while(keitai[i+1]!='0'){
				kazu++;
				i++;
			}
			hyouzi[cnt]=mozi(kazu,keitai[i]);
			i++;
			cnt++;
		}
	}
	
	cout<<hyouzi<<endl;
	delete[] hyouzi;
	return;
}
char mozi(int kazu,char keitai){
	switch (keitai)
	{
	case '1':
		kazu=kazu%5-1;
		if(kazu==-1)	return mozi1[4];
		return mozi1[kazu];
		
	case '2':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi2[2];
		return mozi2[kazu];
		
	case '3':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi3[2];
		return mozi3[kazu];
		
	case '4':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi4[2];
		return mozi4[kazu];
		
	case '5':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi5[2];
		return mozi5[kazu];
		
	case '6':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi6[2];
		return mozi6[kazu];
		
	case '7':
		kazu=kazu%4-1;
		if(kazu==-1)	return mozi7[3];
		return mozi7[kazu];
		
	case '8':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi8[2];
		return mozi8[kazu];
		
	case '9':
		kazu=kazu%4-1;
		if(kazu==-1)	return mozi9[3];
		return mozi9[kazu];
	default:
		return '0';
	}
}

C++: // AOJ 2006
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
  string input;
  string trm = "cfilov";
  while (cin >> input) {
    char c = '\0', current = '\0';
    for (char btn : input) {
      if (c == '\0') {
        if (btn == '1') {
          c = '.';
        } else if (btn == '2') {
          c = 'a';
        } else if (btn == '3') {
          c = 'd';
        } else if (btn == '4') {
          c = 'g';
        } else if (btn == '5') {
          c = 'j';
        } else if (btn == '6') {
          c = 'm';
        } else if (btn == '7') {
          c = 'p';
        } else if (btn == '8') {
          c = 't';
        } else if (btn == '9') {
          c = 'w';
        }
        current = btn;
      } else if (btn == '0') {
        cout << c;
        c = current = '\0';
      } else {
        if (btn != current) {
      //    cout << "guwaa!" << endl;
          goto END;
        }
        if (c == 's' or c == 'z') {
          c -= 3;
        } else if (find(trm.begin(), trm.end(), c) != trm.end()) {
          c -= 2;
        } else if (c == '.') {
          c = ',';
        } else if (c == ',') {
          c = '!';
        } else if (c == '!') {
          c = '?';
        } else if (c == '?') {
          c = ' ';
        } else if (c == ' ') {
          c = '.';
        } else {
          c++;
        }
      }
    }
    cout << endl;
END:
    ;
  }
}