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 <cstdio>
#include <vector>
#include <string>
#include <deque>
#include <stack>
#include <algorithm>
#include <memory.h>

#define rep(idx, max)			for(int idx = 0, idx##Max = (max); idx < idx##Max; idx ++)
#define rrep(idx, min, max)	for(int idx = (min), idx##Max = max; idx < idx##Max; idx ++)
#define erep(idx, min, max)	for(int idx = (min), idx##Max = max; idx <= idx##Max; idx ++)

#define rev(idx, max)			for(int idx = (max) - 1; idx >= 0; idx --)
#define rrev(idx, min, max)	for(int idx = (max) - 1, idx##Min = (min); idx >= idx##Min; idx --)
#define erev(idx, min, max)	for(int idx = (max), idx##Min = (min); idx >= idx##Min; idx --)

#define foreach(it, obj)	for(auto it = obj.begin(), it##End = obj.end(); it >= it##End; it ++)

typedef struct	_DEC
{
	const char *lpszText;
	int length;
} DEC;

void	Decrypt(std::string &dst, std::string &src)
{
	static DEC decTbl[] =
	{
		{"", 0 + 1},	// +1 for prevent 0-DIV
		{".,!? ", 5}, {"abc", 3}, {"def", 3}, {"ghi", 3},
		{"jkl", 3}, {"mno", 3}, {"pqrs", 4}, {"tuv", 3},
		{"wxyz", 4},
	};
	for(int pos = 0, len = src.size(); pos < len; pos ++)
	{
		int ch, sectlen = pos;
		for(ch = src[pos]; src[pos] != '0'; pos ++);
		sectlen = pos - sectlen - 1;
		if(int idx = ch - '0')
		{	dst += decTbl[idx].lpszText[sectlen % decTbl[idx].length];	}
	}
}

int main()
{
	int tc;
	std::cin >> tc;
	while(tc --)
	{
		std::string decText;
		std::string encText;
		std::cin >> encText;
		::Decrypt(decText, encText);
		std::cout << decText << std::endl;
	}
}

C++: #include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main(){
  int n,i,j,k,p;
  string str;
  cin>>n;
  for(j=0;j<n;j++){
    cin >> str;
    p=0;
    char c;
    for(i=0;i<str.size();i++){
      if(str[i]=='0'){
	if(p!=0){
	  if(c=='1'){
	    if(p%5==1) cout << '.';
	    if(p%5==2) cout << ',';
	    if(p%5==3) cout << '!';
	    if(p%5==4) cout << '?';
	    if(p%5==0) cout << " ";
	  }
	  if(c=='2'){
	    printf("%c", ('a'+(p-1)%3));
	  }
	  if(c=='3'){
	    printf("%c", ('d'+(p-1)%3));
	  }
	  if(c=='4'){
	    printf("%c", ('g'+(p-1)%3));
	  }
	  if(c=='5'){
	    printf("%c", ('j'+(p-1)%3));
	  }
	  if(c=='6'){
	   printf("%c", ('m'+(p-1)%3));
	  }
	  if(c=='7'){
	    printf("%c", ('p'+(p-1)%4));
	  }
	  if(c=='8'){
	    printf("%c", ('t'+(p-1)%3));
	  }
	  if(c=='9'){
	    printf("%c", ('w'+(p-1)%4));
	  }
	}
	p=0;
      }else{
	c=str[i];
	p++;
      }
      
    }
    cout << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
    char lis[10][10]={
        "",
        ".,!? ",
        "abc",
        "def",
        "ghi",
        "jkl",
        "mno",
        "pqrs",
        "tuv",
        "wxyz",
    };
    int n;
    scanf("%d",&n);
    while(n--){
        char str[2024];
        scanf("%s",str);
        int v,cnt=-1;
        for(int i=0;str[i];i++){
            if(str[i]=='0'){
                if(cnt!=-1){
                    printf("%c",lis[v][cnt]);
                    cnt=-1;
                }
            }
            else{
                v=str[i]-'0';
                cnt++;
                cnt%=strlen(lis[v]);
            }
        }
        puts("");
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<string> G(10);
  G[1] = ".,!? ";
  G[2] = "abc";
  G[3] = "def";
  G[4] = "ghi";
  G[5] = "jkl";
  G[6] = "mno";
  G[7] = "pqrs";
  G[8] = "tuv";
  G[9] = "wxyz";
  int N;
  cin >> N;
  for(int i=0; i<N; i++){
    string S;
    cin >> S;
    vector<pair<char,int>> vec;
    vec.emplace_back('0',1);
    for(int j=0; j<S.size(); j++){
      if(S[j] == '0'){
        vec.emplace_back('0',1);
      }else{
        if(vec.back().first == S[j]){
          vec.back().second++;
        }else{
          vec.emplace_back(S[j],1);
        }
      }
    }
    string ans = "";
    string temp = "";
    for(int j=0; j<vec.size(); j++){
      if(vec[j].first == '0'){
        ans += temp;
        temp = "";
      }else{
        temp += G[vec[j].first-'0'][(vec[j].second-1)%G[vec[j].first-'0'].size()];
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef long long  ll;
typedef pair<int, int> P;

/** Problem2006 : Keitai Message **/
int main()
{
	string list[10] = {" ", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
	int l[10] = {0, 5, 3, 3, 3, 3, 3, 4, 3, 4};
	int n;
	cin >> n;
	rep(k, n) {
		string in, ans;
		cin >> in;
		int tmp=-1; char c=' ';
		rep(i, in.length()) {
			if (in[i]!='0') {
				tmp++; tmp%=l[in[i]-'0'];
				c = list[in[i]-'0'][tmp];
			} else {
				if (c != ' ')
					ans+=c;
				tmp=-1;
				c=' ';
			}
		}
		cout << ans << endl;
	}
}

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

int main(){
	const char C[10][6] = {
		{},
		{'.',',','!','?',' ', 5 },
		{'a','b','c', 0 , 0 , 3 },
		{'d','e','f', 0 , 0 , 3 },
		{'g','h','i', 0 , 0 , 3 },
		{'j','k','l', 0 , 0 , 3 },
		{'m','n','o', 0 , 0 , 3 },
		{'p','q','r','s', 0 , 4 },
		{'t','u','v', 0 , 0 , 3 },
		{'w','x','y','z', 0 , 4 },
	};
	int n;
	cin >> n;
	for(int i=0 ; i<n ; ++i ){
		char s[1025];
		cin >> s;
		char c = 0;
		int pos = -1;
		for(int j=0 ; s[j] ; ++j ){
			int button = s[j] - '0' ;
			if( button == 0 ){
				if( c != 0 ) cout << c ;

				pos = -1;
				c = 0;
			}else{
				pos++;
				c = C[ button ][ pos % (int)(C[button][5]) ];
			}
		}
		cout << endl;
	}
}