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<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<complex>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS (long double) 1e-8
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	int t;
	cin>>t;
	REP(roop, t) {
		string s;
		string res = "";
		cin>>s;
		char buf = s[0];
		int cnt = 0;
		REP(i, s.size()) {
			if(s[i] == '0') {
				if(cnt == 0) {
					if(i + 1 < s.size()) buf = s[i + 1];
					continue;
				}
				int num = buf - '0';
				if(num == 1) {
					switch(cnt % 5) {
						case 1: {
							res += ".";
							break;
						}
						case 2: {
							res += ",";
							break;
						}
						case 3: {
							res += "!";
							break;
						}
						case 4: {
							res += "?";
							break;
						}
						case 0: {
							res += " ";
							break;
						}
					}
				} else if(num < 7) {
					res += (char)(('a' + (num - 2) * 3) + ((cnt - 1) % 3));
				} else if(num == 7){
					res += (char)('p' + ((cnt - 1) % 4));
				} else if(num == 8){
					res += (char)('t' + ((cnt - 1) % 3));
				} else {
					res += (char)('w' + ((cnt - 1) % 4));
				}
				if(i + 1 < s.size()) buf = s[i + 1];
				cnt = 0;
			} else {
				++cnt;
			}
		}
		cout<<res<<endl;
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	string a,b;
	while (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 <vector>
#include <string>

using namespace std;

vector<vector<char> > data;

string parse(string msg){
  string res = "";
  int state = 0;
  int time = 0;
  for(auto c : msg){
    if(c == '0'){
      if(time == 0) continue;

      if(time % data[state-1].size() == 0){
        res += data[state-1][data[state-1].size() - 1];
      }else{
        res += data[state-1][time % data[state-1].size() - 1];
      }
      time = 0;
    }else{
      int num = c - '0';
      if(state != num){
        state = num;
        time = 1;
      }else{
        time++;
      }
    }
  }
  return res;
}

void init(){
  data.push_back({'.',',','!','?',' '});
  data.push_back({'a','b','c'});
  data.push_back({'d','e','f'});
  data.push_back({'g','h','i'});
  data.push_back({'j','k','l'});
  data.push_back({'m','n','o'});
  data.push_back({'p','q','r','s'});
  data.push_back({'t','u','v'});
  data.push_back({'w','x','y','z'});
}

int main(){
  int n;
  string msg;
  init();
  cin >> n;
  for(int i=0;i<n;i++){
    cin>> msg;
    cout << parse( msg ) << endl;
  }
  return 0;
}