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++: #define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

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 s, ans;
		cin >> s;
		rep(i,0,s.size()) {
			while(s[i] == '0') i++;
			int cnt = 0;
			int j = i;
			while(j+1 < s.size() && s[j+1] != '0') {
				cnt++;
				j++;
			}
			if (s[i] == '1') {
				ans += b1[cnt%5];
			}
			else if (s[i] == '2') {
				ans += b2[cnt%3];
			}
			else if (s[i] == '3') {
				ans += b3[cnt%3];
			}
			else if (s[i] == '4') {
				ans += b4[cnt%3];
			}
			else if (s[i] == '5') {
				ans += b5[cnt%3];
			}
			else if (s[i] == '6') {
				ans += b6[cnt%3];
			}
			else if (s[i] == '7') {
				ans += b7[cnt%4];
			}
			else if (s[i] == '8') {
				ans += b8[cnt%3];
			}
			else if (s[i] == '9') {
				ans += b9[cnt%4];
			}
			i = j;
			while(s[i] == '0') i++;
		}
		cout << ans << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main(){
  int n,i,j,k,p;
  string str;
  cin>>n;
  for(j=0;j<n;j++){
    cin >> str;
    p=0;
    char c;
    for(i=0;i<str.size();i++){
      if(str[i]=='0'){
	if(p!=0){
	  if(c=='1'){
	    if(p%4==1) cout << '.';
	    if(p%4==2) cout << ',';
	    if(p%4==3) cout << '!';
	    if(p%4==0) cout << '?';
	  }
	  if(c=='2'){
	    printf("%c", ('a'+(p-1)%3));
	  }
	  if(c=='3'){
	    printf("%c", ('d'+(p-1)%3));
	  }
	  if(c=='4'){
	    printf("%c", ('g'+(p-1)%3));
	  }
	  if(c=='5'){
	    printf("%c", ('j'+(p-1)%3));
	  }
	  if(c=='6'){
	   printf("%c", ('m'+(p-1)%3));
	  }
	  if(c=='7'){
	    printf("%c", ('p'+(p-1)%4));
	  }
	  if(c=='8'){
	    printf("%c", ('t'+(p-1)%3));
	  }
	  if(c=='9'){
	    printf("%c", ('w'+(p-1)%4));
	  }
	}
	p=0;
      }else{
	c=str[i];
	p++;
      }
      
    }
    cout << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;

int main(){
  int n;
  scanf("%d",&n);
  char s[2000];
  rep(i,n){
    scanf("%s",s);
    int len = strlen(s);
    char now = 0;
    rep(j,len){
      if(!now && s[j]=='0') continue;
      else if(s[j]=='0') {putchar(now); now = 0;}
      else if(s[j]=='1'){
        if(now=='.') now = ',';
        else if(now==',') now = '!';
        else if(now=='!') now = '?';
        else if(now=='?') now = ' ';
        else if(now==' ' || now==0) now = '.';
      }
      else if(s[j]=='2'){ if(now==99 || !now) now = 97; else now++;}
      else if(s[j]=='3'){ if(now==102 || !now) now = 100; else now++;}
      else if(s[j]=='4'){ if(now==105 || !now) now = 103; else now++;}
      else if(s[j]=='5'){ if(now==108 || !now) now = 106; else now++;}
      else if(s[j]=='6'){ if(now==111 || !now) now = 109; else now++;}
      else if(s[j]=='7'){ if(now==115 || !now) now = 112; else now++;}
      else if(s[j]=='8'){ if(now==118 || !now) now = 116; else now++;}
      else if(s[j]=='9'){ if(now==122 || !now) now = 119; else now++;}
    }
    putchar('\n');
  }


  return 0;

}

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

using namespace std;

#define NMAX 123456

int main(){

	string S[10]={"NULL",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	string in;
	int N;

	cin>>N;
	while(N--){
		cin>>in;
		int c;
		if(in[0]=='0') c=0;
		else c=1;
		for(int i=1;i<in.size();i++){
			if(in[i]=='0'){
				if(c!=0){
					cout<<S[in[i-1]-'0'][(c-1)%S[in[i-1]-'0'].size()];
					c=0;
				}
			}
			else c++;
		}
		cout<<endl;
	}

}

C++: #include <iostream>
using namespace std;
int main(void){
    char code[][5] = {
        {0,0,0,0,0},
        {'.',',','!','?',' '},
        {97,98,99,0,0},
        {100,101,102,0,0},
        {103,104,105,0,0},
        {106,107,108,0,0},
        {109,110,111,0,0},
        {112,113,114,115,0},
        {116,117,118,0,0},
        {119,120,121,122,0}
    };
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string input;
        cin >> input;
        int num = 0;
        int index = 0;
        for (int j = 0; j < input.length(); ++j) {
            if (input[j] == '0') {
                cout << code[num][index];
                num = 0;
                index = 0;
            } else if (!index && !num) {
                num = input[j] - '0';
            } else {
                ++index;
                while(num && !code[num][index]) {
                    if (++index == 5) index = 0;
                }
            }
        }
        cout << endl;
    }
}

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

int changeNumber(char number)
{
	int num = 0;
	for (char i = 48; i < 58; i++) {
		if (number == i) return num;
		num++;
	}
}

int main(void)
{
	string S, message[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
	int sizeS, count, k;
	cin >> count;
	for (int i = 0; i < count; i++) {
		cin >> S;
		k = 0;
		while (k < S.size()) {
			int j, ini = changeNumber(S[k]);
			while (S[k] != '0') {
				for (int i = 0; i < message[ini].size() && S[k] != '0'; i++) {
					k++;
					j = i;
				}
			}
			cout << message[ini][j]; 
			k++;
		}
		cout << endl;
	}
	
	return 0;
}