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>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int main(void){
	pair<int, string> deta[10];//int mod string ?????????
	deta[1] = mp(5, ".,!? ");
	deta[2] = mp(3, "abc");
	deta[3] = mp(3, "def");
	deta[4] = mp(3, "ghi");
	deta[5] = mp(3, "jkl");
	deta[6] = mp(3, "mno");
	deta[7] = mp(4, "pqrs");
	deta[8] = mp(3, "tuv");
	deta[9] = mp(4, "wxyz");
	//deta[0] = mp(0, "");

	int n; cin >> n;
	int tmp;
	rep(i, n){
		string tmp;
		cin >> tmp;
		int size = tmp.size();
		int cnt = 0;
		rep(j, size){
			//printf("j %d\n", j);
			if(tmp[j] == '0') continue;//?????????????????????????????????
	
			if(tmp[j] == tmp[j + 1]){
				cnt++;
				//printf("cnt++%d\n", cnt);
				continue;
			}
			else{
				int num = tmp[j] - '0';
				//printf("num%d\n", num);
				string moziretu = deta[num].se;
				//cout << moziretu <<endl;
				printf("%c", moziretu[cnt % deta[num].fi]);
				cnt = 0;
			}
		}
		printf("\n");
	}
	return 0;
}

C++: #include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

string solve(string s){
    int count=0;
    string ans;
    char keep;
    string keeps;
    char c='0';
    for(int i=0;i<s.size();i++){
        // char k=s[i];
        if(s[i]!='0'){
            count++;
            c=s[i];
        }
        else{
            if(count!=0){
                if(c== '2'){
                    if(count%3==1)ans.append(1,'a');
                    else if(count%3==2)ans.append(1,'b');
                    else ans.append(1,'c');
                }
                else if(c== '3'){
                    if(count%3==1)ans.append(1,'d');
                    else if(count%3==2)ans.append(1,'e');
                    else ans.append(1,'f');
                }
                else if(c== '4'){
                    if(count%3==1)ans.append(1,'g');
                    else if(count%3==2)ans.append(1,'h');
                    else ans.append(1,'i');
                }
                else if(c== '5'){
                    if(count%3==1)ans.append(1,'j');
                    else if(count%3==2)ans.append(1,'k');
                    else ans.append(1,'l');
                }
                else if(c== '6'){
                    if(count%3==1)ans.append(1,'m');
                    else if(count%3==2)ans.append(1,'n');
                    else ans.append(1,'o');
                }
                else if(c== '7'){
                    if(count%4==1)ans.append(1,'p');
                    else if(count%4==2)ans.append(1,'q');
                    else if(count%4==3)ans.append(1,'r');
                    else ans.append(1,'s');
                }
                else if(c== '8'){
                    if(count%3==1)ans.append(1,'t');
                    else if(count%3==2)ans.append(1,'u');
                    else ans.append(1,'v');
                }
                else if(c== '9'){
                    if(count%4==1)ans.append(1,'w');
                    else if(count%4==2)ans.append(1,'x');
                    else if(count%4==3)ans.append(1,'y');
                    else ans.append(1,'z');
                }
                else if(c== '1'){
                    if(count%4==1)ans.append(1,'.');
                    else if(count%4==2)ans.append(1,',');
                    else if(count%4==3)ans.append(1,'!');
                    else ans.append(1,'?');
                }
                count=0;
            }
        }
    }
    // cout << ans << "%%%%%%%%%%%%%%%%"<<endl;
    return ans;
}

int main(int argc, char const *argv[]) {
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    vector<string>ans;
    for(int i=0;i<n;i++){
        cin >> s;
        ans.push_back(solve(s));
    }
    for(int i=0;i<n;i++){
        cout << ans[i]<<endl;
    }
}