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;

void solve(string s){
    
    vector<vector<char>> v;
    vector<char> tmp;
    tmp.push_back('.');
    tmp.push_back(',');
    tmp.push_back('!');
    tmp.push_back('?');
    tmp.push_back(' ');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('a');
    tmp.push_back('b');
    tmp.push_back('c');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('d');
    tmp.push_back('e');
    tmp.push_back('f');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('g');
    tmp.push_back('h');
    tmp.push_back('i');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('j');
    tmp.push_back('k');
    tmp.push_back('l');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('m');
    tmp.push_back('n');
    tmp.push_back('o');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('p');
    tmp.push_back('q');
    tmp.push_back('r');
    tmp.push_back('s');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('t');
    tmp.push_back('u');
    tmp.push_back('v');
    v.push_back(tmp);
    tmp.clear();
    tmp.push_back('w');
    tmp.push_back('x');
    tmp.push_back('y');
    tmp.push_back('z');
    v.push_back(tmp);
    tmp.clear();
    
    int t;
    for(auto itr=s.begin()+1;itr!=s.end();itr++){
        if(*itr=='0'){
            if(*(itr-1)!='0'){
                t=*(itr-1)-'0';
                int count=0;
                for(auto it=itr-1;*it!='0';it--){
                    count++;
                    if(it==s.begin()||*(it-1)=='0'){
                        break;
                    }
                }
                cout<<v[t-1][(count-1)%v[t-1].size()];
                
            }
        }
    }
    cout<<endl;
    
}


int main(void){
    int n;
    cin>>n;
    string s;
    for(int i=0;i<n;i++){
        cin>>s;
        solve(s);
    }
    
}

C++: #include <iostream>
#include <string.h>
using namespace std;

int main(void)
{
	string S, message[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
	int N, k;
	cin >> N;
	while (N--) {
		cin >> S;
		int count = -1, k = S[0] - '0';
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == '0') {
				if (k != 0) {
					count %= message[k].size();
					cout << message[k][count];
				}
				k = S[i + 1] - '0';
				count = -1;
			}else {
				count++;
			}
		}
		cout << endl;
	}	
	return 0;
}

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

char b1[5]={'.' , ',' , '!' , '?' , ' '};
char b2[3]={'a' , 'b' , 'c'};
char b3[3]={'d' , 'e' , 'f'};
char b4[3]={'g' , 'h' , 'i'};
char b5[3]={'j' , 'k' , 'l'};
char b6[3]={'m' , 'n' , 'o'};
char b7[4]={'p' , 'q' , 'r' , 's'};
char b8[3]={'t' , 'u' , 'v'};
char b9[4]={'w' , 'x' , 'y' , 'z'};

int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		string in,out;
		cin>>in;
		int cnt=0;
		for(int i=0;i<in.size();i++)
		{
			if(in[i]==0&&cnt==0) continue;
			else if(in[i]!='0') cnt++;
			else
			{
				switch(in[i-1]){
					case '1':
						out+=b1[(cnt-1)%5];
						break;
					case '2':
						out+=b2[(cnt-1)%3];
						break;
					case '3':
						out+=b3[(cnt-1)%3];
						break;
					case '4':
						out+=b4[(cnt-1)%3];
						break;
					case '5':
						out+=b5[(cnt-1)%3];
						break;
					case '6':
						out+=b6[(cnt-1)%3];
						break;
					case '7':
						out+=b7[(cnt-1)%4];
						break;
					case '8':
						out+=b8[(cnt-1)%3];
						break;
					case '9':
						out+=b9[(cnt-1)%4];
						break;
				}
				cnt=0;
			}
		}
		cout<<out<<endl;
	}
	return 0;
}

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

int main(void) {

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

    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        string str = "";
        pair<char, int> num;
        num.first = ' ';
        num.second = -1;

        for (auto x : s) {
            if (x == '0') {
                if (num.first == ' ') continue;

                int bi = num.first - '0';
                str += button[bi][num.second % button[bi].size()];
                cout << "### str = " << str << endl;

                num.first = ' ';
                num.second = -1;
                continue;
            }

            num.first = x;
            num.second++;
        }

        cout << str << endl;
    }

    return 0;
}

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

typedef struct {
	int N;
	char C[6];
} INPUT;

INPUT input[10] = {
	{0, ""},
	{5, ".,!? "},
	{3, "abc"},
	{3, "def"},
	{3, "ghi"},
	{3, "jkl"},
	{3, "mno"},
	{4, "pqrs"},
	{3, "tuv"},
	{4, "wxyz"}
};

int main()
{
	int N;
	
	scanf("%d", &N);
	for (int i = 0; i < N; i++){
		char str[2048];
		scanf("%s", str);
		
		int j = 0;
		char now = 0;
		int num = 0;
		while (str[j] != '\0'){
			if (str[j] == '0'){
				if (now != 0){
					printf("%c", input[now - '0'].C[num % input[now - '0'].N ] );
				}
				now = 0;
				num = 0;
			}
			else {
				if (now == 0){
					now = str[j];
				}
				else {
					num++;
				}
			}
			j++;
		}
		
		puts("");
	}
	
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(void){
	int n;
	cin>>n;
	string b[9]={".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	for(int j=0;j<n;j++){
		string s;
		cin>>s;
		int a=-1,time=0;
		string m;
		for(int i=0;i<s.size();i++){
			if(a==s[i]-'1'){
				time++;
			}else if(s[i]=='0'){
				if(a!=-1){
					time%=b[a].size();
					m=b[a][time];
					cout<<m;
					a=-1;
					time=0;
				}
			}else{
				time=0;
				a=s[i]-'1';
			}

		}
		cout<<endl;

	}
	return 0;
}

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double EPS = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

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

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	cin >> n;
	rep(i, n) {
		cin >> s;
		int num = s[0] - '0', cnt = 0;
		REP(j, 1, s.size()) {
			if (s[j] != s[j - 1] || num == 0) {
				if (num != 0) cout << table[num][cnt];
				cnt = 0;
				num = s[j] - '0';
			} else {
				cnt = (cnt + 1) % table[num].size();
			}
		}
		cout << endl;
	}
	return 0;
}