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 <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){

  int m;
  cin>>m;
  REP(i,m){
    string str;
    int num[1000]={0};
    char now;
    int out=0;
    char one[5]={'.',',','!','?',' '};
    cin >> str;
    int hoge = str.size();
    REP(i,hoge){
      num[i] = str[i] - '0';
    };
    REP(c,hoge){
      int k=0;
      if(num[c]==1){
	while(num[c]==1){
	  k++;
	  c++;
	}
	out=(k+4)%5;
	cout << one[out];
      }else if(num[c]==2){
	while(num[c]==2){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'a'+out;
	cout << now;
      }else if(num[c]==3){
	while(num[c]==3){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'd'+out;
	cout << now;
      }else if(num[c]==4){
	while(num[c]==4){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'g'+out;
	cout << now;
      }else if(num[c]==5){
	while(num[c]==5){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'j'+out;
	cout << now;
      }else if(num[c]==6){
	while(num[c]==6){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'm'+out;
	cout << now ;
      }else if(num[c]==7){
	while(num[c]==7){
	  k++;
	  c++;
	}
	out=(k+3)%4;
	now = 'p'+out;
	cout << now;
      } else if(num[c]==8){
	while(num[c]==8){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 't'+out;
	cout << now;
      }else if(num[c]==9){
	while(num[c]==9){
	  k++;
	  c++;
	}
	out=(k+3)%4;
	now = 'w'+out;
	cout << now;
      }
    }
      cout << endl;
  }}

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", "pqls", "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';
				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<bits/stdc++.h>
using namespace std;
int main(){
	char a[9][5]={{'.',',','!','?',' '},{'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'}};
	int n,c=0,d=0;
	string s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;d=c=0;
			for(int j=0;j<s.size();j++){
				if(s[j]=='0'&&c>0){
					if(s[j-1]=='1')d=(c-1)%5;
					else if(s[j-1]=='7'||s[j-1]=='9')d=(c-1)%4;
					else d=(c-1)%3;
					cout<<a[(int)(s[j-1]-'0')-1][d];
				c=0;
				}
				else if(s[j]=='0'&&s[j-1]=='0')continue;;
				else c++;
				}
				cout<<'\n';
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n; cin>>n;
	char a[5]={'.',',','!','?',' '};
	rep(h,n){
		string s; cin>>s;
		string ans="";
		int key=0,cnt=-1;
		int x=s.size();
		rep(i,x){
			if(s[i]=='0'){
				switch(key){
					case 0:
						break;
					case 1:
						ans+=a[0+cnt%5];
						break;
					case 2:
						ans+='a'+(cnt%3);
						break;
					case 3:
						ans+='d'+(cnt%3);
						break;
					case 4:
						ans+='g'+(cnt%3);
						break;
					case 5:
						ans+='j'+(cnt%3);
						break;
					case 6:
						ans+='m'+(cnt%3);
						break;
					case 7:
						ans+='p'+(cnt%4);
						break;
					case 8:
						ans+='t'+(cnt%3);
						break;
					case 9:
						ans+='w'+(cnt%4);
						break;
				}
				cnt=-1;
				key=0;
			}else{
				key=s[i]-'0'; cnt++;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<numeric>
#include<queue>
#include<string>
#include<sstream>

using namespace std;


int main(void) {

  string str[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    string s;
    cin >> s;
    int cnt = 0;
    string ans = "";
    for(int j=0; j<s.size(); j++){
      if( s[j] == '0' && cnt != 0){
        // cerr << cnt << endl;
        ans += str[ s[j-1]-'0' ][ ( (cnt-1) % str[ s[j-1]-'0' ].size() ) ];
        cnt = 0;
      }else if( s[j] != '0' ) cnt++;
    }
    cout << ans << endl;
  }

  return 0;
}










//

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    string a[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    while (n--){
        string s;
        cin >> s;
        int p = -1;
        REP(i,s.length()){
            int x = s[i] - '0';
            if (x == 0 && p >= 0){
                int y = s[i-1]-'0';
                cout << a[y][p % a[y].length()];
                p = -1;
            }
            if (x > 0) p++;
        }
        cout << endl;
    }

    return 0;
}