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;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v),end()
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;

template<typename A,typename B> inline void chmin(A &a,B b){if(a>b) a=b;}
template<typename A,typename B> inline void chmax(A &a,B b){if(a<b) a=b;}
//-----------------------------------------------------------------------

string table[10]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

int n; cin>>n;
while(n--)
{
    string s; cin>>s;
    int cnt=0,idx;
    REP(i,s.size()){
        if(s[i]!='0'){
            cnt++;
            idx=s[i]-'0';
        } else{
            if(cnt>0) cout<<table[idx][(cnt-1)%table[idx].size()];
            cnt=0;
        }
    }
    cout<<endl;
}
}

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

int main(){
  string p[9]={".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
  string s;
  int n;
  cin>>n;
  while(n--){
    cin>>s;
    for(int i=0;i<(int)s.size();i++)
      if(s[i]=='0') s[i]=' ';
    stringstream ss(s);
    while(ss>>s){
      cout<<p[s[0]-'1'][(s.size()-1) % p[s[0]-'1'].size()];
    }
    cout<<endl;
  }

  return 0;
}

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

#define rep(i,n) for(int i=0; i<n; i++)

int main(){
	int n;
	int code;
	int num;
	char key[11][7] = {
			{},
			{'.',',','!','?',' '},
			{'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'},
	};

	std::cin >> n;
	std::string str;

	rep(i,n){
		code = 0;
		num = 0;
		std::cin >> str;
		rep(j,(int)str.size()){
			if(str[j] != '0'){
				num++;
			}else{
				if(j > 0 && str[j-1] != '0'){
					code = str[j-1]-'0';
					if(code == 1){
						std::cout << key[code][(num-1)%5] << std::flush;
					}else if(code == 7 || code == 9){
						std::cout << key[code][(num-1)%4] << std::flush;
					}else{
						std::cout << key[code][(num-1)%3] << std::flush;
					}
					code = 0;
					num = 0;
				}
			}
		}
		std::cout << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX  999999
int main(){
    char ans[][10] = {
        {},
        {'.',',','!','?',' '},
        {'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; cin >> n;
    rep(i,n){
        string s(100000,0);
        cin >> s;
        int temp = 0;
        int counter =-1 ;
        for(int k = 0;k<s.size();k++){
            int now = int(s[k]-48);
            if(k == 0){temp = now;counter++;}
            else if(now != 0){
                temp = now;counter++;}
            if(now == 0){
                if(temp  == 9 || temp == 7)
                    counter%=4;
                else if(temp != 1&& temp != 7 && temp!= 9)
                    counter%=3;
                else if(temp == 1)
                    counter %=5;
                cout << ans[temp][counter];
                temp = 0;counter =-1;;
            }
        }
        cout << endl;
    }
}

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 <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
  vector<vector<char> > v;
  vector<char> mv;

  mv.push_back(' ');mv.push_back('.');mv.push_back(',');mv.push_back('!');mv.push_back('?');
  v.push_back(mv);
  mv.clear();

  mv.push_back('c');mv.push_back('a');mv.push_back('b');
  v.push_back(mv);
  mv.clear();

  mv.push_back('f');mv.push_back('d');mv.push_back('e');
  v.push_back(mv);
  mv.clear();

  mv.push_back('i');mv.push_back('g');mv.push_back('h');
  v.push_back(mv);
  mv.clear();

  mv.push_back('l');mv.push_back('j');mv.push_back('k');
  v.push_back(mv);
  mv.clear();

  mv.push_back('o');mv.push_back('m');mv.push_back('n');
  v.push_back(mv);
  mv.clear();

  mv.push_back('s');mv.push_back('p');mv.push_back('q');mv.push_back('r');
  v.push_back(mv);
  mv.clear();

  mv.push_back('v');mv.push_back('t');mv.push_back('u');
  v.push_back(mv);
  mv.clear();

  mv.push_back('z');mv.push_back('w');mv.push_back('x');mv.push_back('y');
  v.push_back(mv);
  mv.clear();

  string s;
  int a,i,cou,n,cou2,b;
  cin >>b;
  for(int j=0;j<b;j++){ // 入力
    cin>>s;
    a=s.size();
    //cout <<a<< ' ';//////////////////
    i=0;
    cou2=0;
    while(i<a){//改行まで
      cou=0;
      n=0;
      while(s[i]!='0'&&i<a){//０まで
	if(n!=s[i]-'0')cou=0;
	n=s[i]-'0';
	i++;
	cou++;
      }
      i++;
      //cout <<n<< cou<< ' ';/////////////////
      if(cou!=0&&i<=a){
	if(n==8||n==2||n==3||n==4||n==5||n==6)cou=cou%3;
	else if(n==7||n==9)cou=cou%4;
	else if(n==1)cou=cou%5;

	cout<<v[n-1][cou];
	cou2++;
      }
    }
    if(cou2!=0)cout<<endl;
  }
  return 0;
}