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;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  vector<string> v = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
  int q; cin >> q;
  while(q > 0) {
    q--;
    string s; cin >> s;
    vector<pair<int, int>> p;
    char now = s[0];
    int cnt = 1;
    for(int i=1;i<(int)(s.size());++i) {
      if(s[i] == now) {
        cnt++;
      } else {
        p.push_back({now-'0', cnt});
        now = s[i];
        cnt = 1;
      }
    }
    p.push_back({now-'0', cnt});
    string ans = "";
    for(int i=0;i<(int)(p.size())-1;++i) {
      if(p[i].first != 0 && p[i+1].first == 0) {
        ans.push_back(v[p[i].first][(p[i].second-1) % (int)(v[p[i].first].size())]);
      }
    }
    cout << ans << endl;
  }
}

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

int main(){
	string str;
	char m[10000],a[10000],p,c[10000];
	char b[10][5]={{'-','-','-','-','-'},{'.',',','!','?',' '},{'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','-'}};
	int n;
	int d=-1;
	int e=0;
	int j;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>str;
		p=0;
		j=0;
		d=-1;
		e=0;
		for(int i=0;i<str.size();i++){
			if(i==0){
				d=0;
				e=str[i]-'0';
			}
			else if(str[i-1]!=str[i]){
				if(str[i-1]!='0'){
					c[j]=b[e][d];
					j++;
				}
				d=0;
				e=str[i]-'0';
			}
			else{
				d++;
				if(b[e][d]=='-' || d==5){
					d=0;
				}
			}
		}
		for(int i=0;i<j;i++){
			cout<<c[i];
		}
		cout<<endl;
	}
	return 0;
}

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

int main()
{
    int n;
    string str;
    char a[7][3] = {{'a','b','c'},{'d','e','f'},{'g','h','i'},
                     {'j','k','l'},{'m','n','o'},{},{'t','u','v'}};
    char b[3][4] = {{'p','q','r','s'},{},{'w','x','y','z'}};
    char c[5] = {'.',',','!','?',' '};

    cin >> n;

    while( n-- )
    {
        cin >> str;

        int j = 0;
        char d;
        for( int i = 0; i < str.size(); i++ )
        {
            if( str[i] == '0' )
            {
                if( i - 1 >= 0 && str[i-1] != '0' )
                    cout << d;
                j = 0;
            }
            else if( str[i] == '1' )
            {
                d = c[j];
                j++;
                j %= 5;
            }
            else if( str[i] == '7' || str[i] == '9' )
            {
                d = b[str[i]-'0'-7][j];
                j++;
                j %= 4;
            }
            else
            {
                d = a[str[i]-'0'-2][j];
                j++;
                j %= 3;
            }
        }
        cout << endl;
    }
    return 0;
}

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

string str[10]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		int b=0,c=0;
		for(int j=0;j<s.size();j++){
			if(s[j]=='0'){
				if(b){
					cout<<str[b][c%str[b].size()];
				}
				b=0;
			}else{
				if(s[j]-'0'==b){
					c++;
				}else{
					b=s[j]-'0';
					c=0;
				}
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: 
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <stdlib.h>

using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	int n;
	cin >> n;

	char c[10][5] = {
		{'*', '*', '*', '*', '*'},
		{'.', ',', '!', '?', ' '},
		{'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', '*'}
	};
	int max[] = {
	//  0, 1, 2, 3, 4, 5, 6, 7, 8, 9
		0, 5, 3, 3, 3, 3, 3, 4, 3, 4
	};

	for(int i = 0; i < n; i++) {
		string number;
		string message;
		int num, flg = 0, sel = 0;
		char ch;
		cin >> number;

		for(int j = 0; j < number.length(); j++) {
			num = atoi( number.substr(j, 1).c_str() );
			if(num == 0) {
				if(flg == 0) continue;
				else message += ch;
				flg = 0;
				sel = 0;
			} else {
				flg = 1;
				ch = c[num][sel];
				sel ++;
				if(sel >= max[num]) sel = 0;
			}
		}

		cout << message << endl;

	}

	//while(1){}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

string keitai[]{".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
int main(){
	string s;
	while(cin>>s){
		int cnt=0;
		string ans;
		rep(i,s.size()){
			if(s[i]=='0'){
				if(cnt)ans+=keitai[s[i-1]-'1'][(cnt-1)%keitai[s[i-1]-'1'].size()];
				cnt=0;
			}
			if(i&&s[i-1]!=s[i])cnt=0;
			else cnt++;
		}
		cout<<ans<<endl;
	}
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  int n,j,knum;
  string s;
  string c[10] = {"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
  cin >> n;
  while(n){
    cin >> s;
    for(int i = 0;i<s.size();i++){
      if(s[i] == '0')continue;
      for(j=0;j<s.size();j++)
	if(s[i+j+1] == '0')break;
      knum = j%c[s[i]-'0'].size();
      cout << c[s[i]-'0'][knum];
      i += j;
    }
    cout << "\n";
    n--;
  }

  return 0;
}