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<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX  999999
int main(){
    char ans[][10] = {
        {},
        {'.',',','!','?',' '},
        {'a','b','c'},
        {'d','e','f'},
        {'g','h','i'},
        {'j','k','l'},
        {'m','n','o'},
        {'p','q','r','s'},
        {'t','u','v'},
        {'w','x','y','z'}
    };
    ll n; cin >> n;
    rep(i,n){
        string s(100000,0);
        cin >> s;
        int temp = 0;
        int counter =-1 ;
        for(int k = 0;k<(int)s.size();k++){
            int now = int(s[k]-48);
            if(k == 0){temp = now;counter++;}
            else if(now != 0){
                temp = now;counter++;}
            if(now == 0){
                if(temp  == 9 || temp == 7)
                    counter= counter%4;
                else if(temp != 1&& temp != 7 && temp!= 9)
                    counter=counter%3;
                else if(temp == 1)
                    counter =counter%5;
                cout << ans[temp][counter];
                temp = 0;counter =-1;;
            }
        }
        cout << endl;
    }
    return 0;
}

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 && 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 <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';
            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<iostream>
#include<cstring>
using namespace std;
int main(){
	int n,temp,sum,box[]={1,5,3,3,3,3,3,4,3,4};
	char s[1030];
	char tab[10][5]={" ",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	cin>>n;
	while(n--){
		cin>>s;
		sum=0;
		for(int i=0;i<(int)strlen(s);i++){
			if(s[i]=='0'){
				if(sum!=0){
					cout<<tab[temp][(sum-1)%box[temp]];
				}
				sum=0;
			}
			else{
				temp=s[i]-'0';
				sum++;
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	cin>>n;
    string a,b;
    for(int j=0;j<n;j++){
    	cin>>a;
        if(a=="0") break;
        int la=a.size();
        int c=0;
        for(int i=0;i<la;i++){
            if(a[i]=='0'){
                if(b=="1"){
                    c=c%5;
                    if(c==1) cout<<".";
                    if(c==2) cout<<",";
                    if(c==3) cout<<"!";
                    if(c==4) cout<<"?";
                    if(c==0) cout<<" "; 
                }
                if(b=="2"){
                    c=c%3;
                    if(c==1) cout<<"a";
                    if(c==2) cout<<"b";
                    if(c==0) cout<<"c";
                }
                if(b=="3"){
                    c=c%3;
                    if(c==1) cout<<"d";
                    if(c==2) cout<<"e";
                    if(c==0) cout<<"f";
                }
                if(b=="4"){
                    c=c%3;
                    if(c==1) cout<<"g";
                    if(c==2) cout<<"h";
                    if(c==0) cout<<"i";
                }
                if(b=="5"){
                    c=c%3;
                    if(c==1) cout<<"j";
                    if(c==2) cout<<"k";
                    if(c==0) cout<<"l";
                }
                if(b=="6"){
                    c=c%3;
                    if(c==1) cout<<"m";
                    if(c==2) cout<<"n";
                    if(c==0) cout<<"o";
                }
                if(b=="7"){
                    c=c%4;
                    if(c==1) cout<<"p";
                    if(c==2) cout<<"q";
                    if(c==3) cout<<"r";
                    if(c==0) cout<<"s";
                }
                if(b=="8"){
                    c=c%3;
                    if(c==1) cout<<"t";
                    if(c==2) cout<<"u";
                    if(c==0) cout<<"v";
                }
                if(b=="9"){
                    c=c%4;
                    if(c==1) cout<<"w";
                    if(c==2) cout<<"x";
                    if(c==3) cout<<"y";
                    if(c==0) cout<<"z";
                }
                c=0;
                b="0";
            }
            else{
                b=a[i];
                c++;
            }
        }
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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

int main() {
  int n;
  
  cin >> n;
  while(n--) {
    string s;
    cin >> s;
    int N = s.size();
    int pos = -1;
    int stock = -1;
    for(int i=0; i<N; i++) {
      int button = s[i]-'0'-1;
      if(button == -1) {
	if(stock != -1)
	  cout << mes[stock][pos%(mes[stock].size())];
	stock = -1;
	pos = -1;
      }
      else {
	stock = button;
	pos ++;
      }
    }
    cout << endl;
  }
  
  return 0;
}