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	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int INF=1000000;
char fi[101][101];
int d[21][21];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;

int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003

int dp[353][353]={0};
int bow[353][353]={0};


int main(){
	
	string s;
	
	while(cin>>s){
		vector<string> p(10);
		p[1]=".,!? ";
		p[2]="abc";
		p[3]="def";
		p[4]="ghi";
		p[5]="jkl";
		p[6]="mno";
		p[7]="pqrs";
		p[8]="tuv";
		p[9]="wxyz";
		bool f=false;
		char c='0';
		int count=0;
		string a="";
		rep(i,s.size()){
			if(s[i]=='0'){
				if(f){
				if(c=='1'){
					count=(count-1)%5;
				}
				else if(c=='7'&&c=='9'){
					count=(count-1)%4;
				}
				else{
					count=(count-1)%3;
				}
				a+=p[c-'0'][count];
				f=false;
				count=0;
				c='0';
				}
			}
			else{
				f=true;
				if(c!=s[i]){
					c=s[i];
					count=1;
				}
				else
					count++;
				
			}
			
		}
		cout<<a<<endl;
	}
	
}

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

using namespace std;
int main()
{
    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        string msg;
        string output = "";
        int count = 0;
        char buf = '\0';

        cin >> msg;

        for (int j = 0; j < (int)msg.size(); j++) {
            char c = msg[j];

            if (c == '0' && j != 0) {
                if (buf == '1') {
                    if (count % 5 == 1)
                        output += ".";
                    else if (count % 5 == 2)
                        output += ",";
                    else if (count % 5 == 3)
                        output += "!";
                    else if (count % 5 == 4)
                        output += "?";
                    else if (count % 5 == 0)
                        output += " ";
                } else if (buf == '2') {
                    if (count % 3 == 1)
                        output += "a";
                    else if (count % 3 == 2)
                        output += "b";
                    else if (count % 3 == 0)
                        output += "c";
                } else if (buf == '3') {
                    if (count % 3 == 1)
                        output += 'd';
                    else if (count % 3 == 2)
                        output += 'e';
                    else if (count % 3 == 0)
                        output += 'f';
                } else if (buf == '4') {
                    if (count % 3 == 1)
                        output += 'g';
                    else if (count % 3 == 2)
                        output += 'h';
                    else if (count % 3 == 0)
                        output += 'i';
                } else if (buf == '5') {
                    if (count % 3 == 1)
                        output += 'j';
                    else if (count % 3 == 2)
                        output += 'k';
                    else if (count % 3 == 0)
                        output += 'l';
                } else if (buf == '6') {
                    if (count % 3 == 1)
                        output += 'm';
                    else if (count % 3 == 2)
                        output += 'n';
                    else if (count % 3 == 0)
                        output += 'o';
                } else if (buf == '7') {
                    if (count % 4 == 1)
                        output += 'p';
                    else if (count % 4 == 2)
                        output += 'q';
                    else if (count % 4 == 3)
                        output += 'r';
                    else if (count % 4 == 0)
                        output += 's';
                } else if (buf == '8') {
                    if (count % 3 == 1)
                        output += 't';
                    else if (count % 3 == 2)
                        output += 'u';
                    else if (count % 3 == 0)
                        output += 'v';
                } else if (buf == '9') {
                    if (count % 4 == 1)
                        output += 'w';
                    else if (count % 4 == 2)
                        output += 'x';
                    else if (count % 4 == 3)
                        output += 'y';
                    else if (count % 4 == 0)
                        output += 'z';
                }
                count = 0;
                buf = '\0';
            } else {
                count++;
                buf = msg[j];
            }
        }
        cout << output << endl;
    }

    return 0;
}

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

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

string solve(string in){
  string res="";
  int c=0;
  int n_in=0;
  for(int i=0;i<in.size();i++){
    int t_in=in[i]-'0';
    if(t_in==0){
      if(n_in!=0){
        res+=push[n_in][(c%push[n_in].size())];
      }
      n_in=0;
      c=0;
    }else{
      if(t_in==n_in){
        c++;
      }else{
        if(n_in!=0){
          res+=push[n_in][(c%push[n_in].size())];
	}
        c=0;
	n_in=t_in;
      }
    }
  }
  return res;
}



int main(){
  string in;
  while(cin>>in){
    string ans=solve(in);
    if(ans.size()!=0){
      cout<<ans<<endl;
    }
  }
}