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 <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

vector<string> button = {
    "kakutei", " .,!?", "cab",  "fde", "igh",
    "ljk",     "omn",   "spqr", "vtu", "zwxy",
};

void solve() {
    string s, ans = "";
    cin >> s;
    vector<int> ncnt(10, 0);
    for(int i = 0; i < s.size(); i++) {
        int now = s[i] - '0';
        if(now == 0) {
            if(i == 0) {
                continue;
            }
            int pre = s[i - 1] - '0';
            if(pre == 0) {
                continue;
            }
            ans += button[pre][ncnt[pre]];
            ncnt.assign(10, 0);
        } else {
            ncnt[now] = (ncnt[now] + 1) % (int)button[now].size();
        }
    }
    cout << ans << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
}

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

using namespace std;

string solve(string s) {
    int num = -1;
    int count = 0;
    string message = "";
    string chars[] = {
        ".,!? ", "abc", "def",
        "ghi", "jkl", "mno",
        "pqrs", "tuv", "wxyz"
    };
    for (int i = 0; i < (int)s.length(); ++i) {
        if (s[i] == '0') {
            if (num > 0) {
                int len = chars[num - 1].length();
                message += chars[num - 1][(count + len - 1) % len];
            }
            count = 0;
            num = -1;
        } else {
            ++count;
            num = s[i] - '0';
        }
    }
    return message;
}

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

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	string list[] = {
		" ",".,!? ","abc","def"
		,"ghi","jkl","mno"
		,"pqrs","tuv","wxyz"
	};
	string str,out;
	int times;
	cin >> times;
	for(int i =0 ;i<times;i++){
		cin >> str;
		char cur='1',cash='a';
		int count = 0,idx;
		int n = 0;
		while(n <str.size()){
			cur = str[n];
			if(cur = 0){
							out +=list[idx][count%=list[idx].size()];
			}
			else if(cur ==cash){
				count +=1;
			}
			else{
				idx= (int)(cur - '0');
			}
			n++;
		}//?????????????????°???????????????
		cout << out << endl;
		out ="";
	}
		return 0;
}

C++: #include <bits/stdc++.h>

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  string lib[10]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
  int t;
  cin >> t;
  for(;t--;){
    string input;
    cin >> input;
    char last='0';
    int ren=0;
    REP(i,SZ(input)){
      if(input[i]==last) ++ren;
      else{
	if(last-'0')
	  cout << lib[last-'0'][ren%SZ(lib[last-'0'])];
	ren=0;
      }
      last=input[i];
    }
    cout << endl;
  }
  return 0;
}

C++: //#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <algorithm>
#include <utility>
#define INF INT_MAX / 2
using namespace std;

typedef pair<int, int> P;
typedef long long ll;

int main(void) {
	
	string c[] = {".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};

	int t;
	cin >> t;
	for(int i=0;i<t;i++){
		int cnt = 0;
		string s;
		cin >> s;
		for(int i=0;i<s.size();i++){
			if(s[i] == '0'){
				if(cnt == 0)continue;
				int n = s[i-1]-'1';
				cout << c[n][(cnt-1)%(c[n].size())];
				cnt = 0;
			}else cnt++;
		}
		cout << endl;
	}

}

// command shift d duplicate
// command ctrl 上下
// command D
// command caps G → '' ""
// vector<vector<int>> a(N,vector<int>(M,-1));