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++: 
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2006

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

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

int main() 
{
	int N;
	cin >> N;
	rep(nth,N)
	{
		int count=0;
		string msg;
		cin >> msg;
		rep(i,msg.length())
		{
			if(msg[i] == msg[i+1]){
			count++;
			}else{
				string tmp = table[(msg[i]-'0')];
				char word = tmp[ count % (tmp.length()) ];
				if(word != '#'){ cout << word; }
				count=0;
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 1;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define MAX 300000
//.....................
ull mod = (int)1e9 + 7;

signed main(void)
{
	string s[10];
	s[1] = ".,!? ";
	s[2] = "abc";
	s[3] = "def";
	s[4] = "ghi";
	s[5] = "jkl";
	s[6] = "mno";
	s[7] = "pqrs";
	s[8] = "tuv";
	s[9] = "wxyz";
	int t;
	cin >> t;
	rep(i, t) {
		string res;
		string message;
		cin >> message;
		char now;
		rep(i, message.size()) {
			now = message[i];
			if (now == '0') continue;
			int cnt = 0;
			REP(j, i + 1, message.size()) {
				if (message[j] != now) {
					cnt = j - i;
					break;
				}
			}
			i += cnt;
			res += s[now - '0'][(cnt - 1) % s[now - '0'].size()];
		}
		cout << res << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  int len;
  int count;
  int i,j;
  int num;
  int flg;
  char moji[10][6]={
    {' ',' ',' ',' ',' '},
    {'.',',','!','?',' '},
    {'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'}
  };

  cin >> n;

  for(i = 0 ; i < n ; i++){
    num = 0;
    count = -1;
    string str;

    cin >> str;

    for(j = 0 ; j < str.size() ; j++){
      flg = 1;
      if(str[j]=='1'){
	num = 1; 
      }else if(str[j]=='2'){
	num = 2; 
      }else if(str[j]=='3'){
	num = 3; 
      }else if(str[j]=='4'){
	num = 4;
      } else if(str[j]=='5'){
	num = 5; 
      }else if(str[j]=='6'){
	num = 6; 
      } else if(str[j]=='7'){
	num = 7;
      }else if(str[j]=='8'){
	num = 8; 
      }else if(str[j]=='9'){
	num = 9; 
      }else{
	if(num == 0){
	  continue;
	}

	if(num == 1){
	  count = count % 5;
	}else if(num == 7 || num == 9){
	  count = count % 4;
	}else{
	  count = count % 3;
	}

	cout << moji[num][count];

	flg = 0;
	count = -1;
	num = 0;
      }
      if(flg == 1) count++;
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	const string TABLE[] = {".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	int n;
	cin >> n;
	for(int i=0;i<n;++i){
		string s;
		string ans;
		int k=0,l=-1;
		bool in = false;
		cin >> s;
		for(int j=0;j<s.size();++j){
			if(s[j]=='0'){
				if(in){
					ans+=TABLE[k][l];
				}
				in = false;
				k=0;
				l=-1;
			}else{
				in = true;
				l++;
				k=s[j]-'1';
				l%=TABLE[k].size();
			}
		}
		cout << ans << "\n";
	}
	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{
        c=0;
	n_in=t_in;
      }
    }
  }
  return res;
}



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

C++: #include<stdio.h>
#include<string.h>
int main()
{
	int n,a[]={0,5,3,3,3,3,3,4,3,4};
	char*p,*q,s[1028],*t[]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	scanf("%d",&n);
	while(n--)
	{
		memset(s,0,1028);
		scanf("%s",s);
		for(p=s;*p;)
		{
			q=strpbrk(p,"0\0");
			if(*p-'0')putchar(t[*p-'0'][(q-p-1)%a[*p-'0']]);
			p=q+1;
		}
		puts("");
	}
	return 0;
}