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 <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it = (c).begin(); it != (c).end(); it++)
#define X first
#define Y second

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const string L[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
int main(void){
    for(string in; cin >> in; cout << endl){
        int cur = 0, cnt = 0;
        rep(i, in.size()){
            if(in.at(i) - '0' == cur) cnt ++;
            else{
                if(in.at(i) == '0'){
                    cout << L[cur].at((cnt + L[cur].size()) % L[cur].size());
                }
                cur = in.at(i) - '0';
                cnt = 0;
            }
        }
    }

    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

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

int main(void){
	int n;
	cin >> n;
	rep(k,n){
		string L;
		cin >> L;
		int count = 0;
		for(int i = 0; i < L.size(); i++){
			if(L[i] == '0'){
				if(count == 0)continue;
				int type = L[i-1]-'0';
				if(L[i-1] != '0')cout << s[type][(count-1)%s[type].size()];
				count = 0;
				continue;
			}
			count++;
		}
		cout << endl;
	}
	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int T;
    cin >> T;
    string in;
    while(T--){
        cin >> in;
        int i = 0;
        int n = in.length();
        
        while(i<n){
            int s = i;
            while(i<n && in[i]!='0'){
                i++;
            }
            if(0<i && i<n && in[i-1]-'0'!=0){
                string st = table[in[i-1]-'0'];
                cout << st[(i-s-1)%st.length()];
            }
            i++;
        }
        cout << endl;
    }
    
    return 0;
}

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

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

void solve() {
	string line;
	cin >> line;
	char pre = '0';
	int count = -1;
	for (unsigned i = 0; i < line.size(); ++i) {
		if (line[i] == '0') {
			int key = pre - '0';
			if (key == 0) continue;
			int index = count % button[key].size();
			cout << button[key][index];
			count = -2;
		}
		count++;
		pre = line[i];
	}
	cout << endl;
}

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

C++: #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>
#include <queue>

using namespace std;

char translate(int ch, int succeed_num){
	switch(ch){
	case 1:
		switch(succeed_num%5){
		case 1:return '.';
		case 2:return ',';
		case 3:return '!';
		case 4:return '?';
		case 0:return ' ';
		}
		break;
	case 2:
		switch(succeed_num%3){
		case 1:return 'a';
		case 2:return 'b';
		case 0:return 'c';
		}
		break;
	case 3:
		switch(succeed_num%3){
		case 1:return 'd';
		case 2:return 'e';
		case 0:return 'f';
		}
		break;
	case 4:
		switch(succeed_num%3){
		case 1:return 'g';
		case 2:return 'h';
		case 0:return 'i';
		}
		break;
	case 5:
		switch(succeed_num%3){
		case 1:return 'j';
		case 2:return 'k';
		case 0:return 'l';
		}
		break;
	case 6:
		switch(succeed_num%3){
		case 1:return 'm';
		case 2:return 'n';
		case 0:return 'o';
		}
		break;
	case 7:
		switch(succeed_num%4){
		case 1:return 'p';
		case 2:return 'q';
		case 3:return 'r';
		case 0:return 's';
		}
		break;
	case 8:
		switch(succeed_num%3){
		case 1:return 't';
		case 2:return 'u';
		case 0:return 'v';
		}
		break;
	case 9:
		switch(succeed_num%4){
		case 1:return 'w';
		case 2:return 'x';
		case 3:return 'y';
		case 0:return 'z';
		}
		break;
	}
	return '\0';	//must not reach here
}

int main(){

	int n,index,pre,count;
	char buf[1025],result[100];

	scanf("%d",&n);

	for(int loop = 0; loop < n; loop++){
		scanf("%s",buf);
		index = 0;
		pre = -1;
		count = 0;

		for(int k = 0; buf[k] != '\0'; k++){
			if(buf[k] >= '1' && buf[k] <= '9'){ //1???9?????´???
				count++;
				if(pre == -1){
					pre = buf[k] - '0';
				}
				//???????????¨????¬????'\0'??§???????¢?????????????????????????????????°????????????????????????????????§???????????????
			}else{ //buf[k] == '0' ?¢?????????????
				if(pre == -1){
					//Do nothing
				}else{
					result[index++] = translate(pre,count);
					result[index] = '\0';
					pre = -1;	//???????????????????????§???????????????
				}
				count = 0;
			}
		}
		printf("%s\n",result);
	}
    return 0;
}