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++: /*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


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;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<vector<char>> ans(9);
  ans[0]={'.',',','!','?',' '};
  ans[1]={'a','b','c'};
  ans[2]={'d','e','f'};
  ans[3]={'g','h','i'};
  ans[4]={'j','k','l'};
  ans[5]={'m','n','o'};
  ans[6]={'p','q','r','s'};
  ans[7]={'t','u','v'};
  ans[8]={'w','x','y','z'};
  
  rep(i,n){
    string s;
    cin>>s;
    vector<pair<char,ll>> v;
    runlength(s,v);
    for(auto c:v){
      if(c.first=='0') continue;
      cout<<ans[(c.first-'0')-1][(c.second-1)%ans[(c.first-'0')-1].size()];
    }
    cout<<endl;
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 21

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


void calc(){
  string s,ans;
  vector<pair<int,int> > vec;
  
  cin >> s;

  int last = -1;
  for(int i=0;i<s.size();i++){
    if(i>0 && s[i-1]!='0' && s[i]=='0') vec.push_back({i,i-(last+1)});
    if(s[i]=='0') last = i;
  }
  
  for(int i=0;i<vec.size();i++){
    ans += data[s[vec[i].first-1]-'0'][(vec[i].second-1)%(int)(data[s[vec[i].first-1]-'0'].size())];
  }
    
  cout << ans << endl;
  
  return;
}

int main(){
  int n;

  scanf("%d",&n);
  
  for(int i=0;i<n;i++){
    calc();
  }

  return 0;
}

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

using namespace std;

vector<string>split(string s){
  vector<string>res;
  int pre = 0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0'){
      res.push_back(s.substr(pre,i-pre));
      pre = i+1;
    }
  }
  return res;
}

int main(void){

  map<char,string>mp;
  mp['0']="";
  mp['1']=".,!? ";
  mp['2']="abc";
  mp['3']="def";
  mp['4']="ghi";
  mp['5']="jkl";
  mp['6']="mno";
  mp['7']="pqrs";
  mp['8']="tuv";
  mp['9']="wxyz";
  
  int n;
  cin >> n;

  while(n--){
    string s;
    cin >> s;
    vector<string>res = split(s);
    for(int i=0;i<res.size();i++)
      cout << mp[res[i][0]][(res[i].size()-1)%max(1,(int)mp[res[i][0]].size())];
    cout << endl;
  }
  
  return 0;
}

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Ti4 tuple<int, int, int, int>
#define Tlll tuple<ll, ll, ll>
#define PI 3.141592653589793

int main() {
    int n;
    cin >> n;
    while (n--) {
        string s;
        cin >> s;

        string ans = "";
        string key[10];
        key[1] = ".,!? ";
        key[2] = "abc";
        key[3] = "def";
        key[4] = "ghi";
        key[5] = "jkl";
        key[6] = "mno";
        key[7] = "pqrs";
        key[8] = "tuv";
        key[9] = "wxyz";

        int idx = 0;
        while (idx < s.size()) {
            int sub = 0;
            if (s[idx] == '0') {
                idx++;  continue;
            }
            while (idx + sub < s.size() && s[idx] == s[idx + sub]) sub++;
            sub--;
            ans += key[s[idx] - 48][sub % key[s[idx] - 48].size()];
            idx += sub + 2;
        }
        cout << ans << endl;
    }
}