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<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<cmath>
#include<set>
#include<stack>

using namespace std;

int main()
{
    vector<vector<char> >ph;
    vector<char>c;
    ph.push_back(c);
    c.push_back('.');
    c.push_back(',');
    c.push_back('!');
    c.push_back('?');
    c.push_back(' ');
    ph.push_back(c);
    c.clear();
    
    char cc='a';
    while(cc!='p'){
        for(int i=0;i<3;i++){
            c.push_back(cc++);
        }
        ph.push_back(c);
        c.clear();
    }
    for(int i=0;i<4;i++){
        c.push_back(cc++);
    }
    ph.push_back(c);
    c.clear();
    for(int i=0;i<3;i++){
        c.push_back(cc++);
    }
    ph.push_back(c);
    c.clear();
    for(int i=0;i<4;i++){
        c.push_back(cc++);
    }
    ph.push_back(c);
    
    int n;
    cin>>n;
    while(n--){
        string s;
        cin>>s;
        char cu='#';
        int co=0;
        for(int i=0;i<s.length();i++){
            if(s[i]=='0'){
                if(cu=='#'){
                    continue;
                } else {
                    co--;
                    cout<<ph[cu-'0'][co%(ph[cu-'0'].size())];
                    cu='#';
                    co=0;
                }
            } else {
                co++;
                cu=s[i];
            }
        }
        cout<<endl;
    }
    //freopen("/Users/shitian/Desktop/gcj/gcj/A-large.in", "r", stdin);
    //freopen("/Users/shitian/Desktop/gcj/gcj/out.txt", "w", stdout);
//    int tcase;
//    cin>>tcase;
//    for(int tca=1;tca<=tcase;tca++){
//        cout<<"Case #"<<tca<<": ";
//
//    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    char code[][5] = {
        {0,0,0,0,0},
        {'.',',','!','?',' '},
        {97,98,99,0,0},
        {100,101,102,0,0},
        {103,104,105,0,0},
        {106,107,108,0,0},
        {109,110,111,0,0},
        {112,113,114,115,0},
        {116,117,118,0,0},
        {119,120,121,122,0}
    };
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string input;
        cin >> input;
        int num = 0;
        int index = 0;
        for (int j = 0; j < input.length(); ++j) {
            if (input[j] == '0') {
                cout << code[num][index];
                num = 0;
                index = 0;
            } else if (!index && !num) {
                num = input[j] - '0';
            } else {
                while(num) {
                    if (++index == 5) index = 0;
                    if (code[num][index]) break;
                }
            }
        }
        cout << endl;
    }
}

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

void bo(int,int);

void bo(int t,int m){
  if(t==1){
    if(m%5==1) cout<<".";
  else if(m%5==2) cout<<",";
  else if(m%5==3)cout<<"!";
  else if(m%5==4)  cout<<"?";
  else cout<<" ";
  }else if(t==2){
    if(m%3==1) cout<<"a";
    else if(m%3==2) cout<<"b";
    else cout<<"c";
  }else if(t==3){
    if(m%3==1) cout<<"d";
    else if(m%3==2) cout<<"e";
    else cout<<"f";
  }else if(t==4){
    if(m%3==1) cout<<"g";
    else if(m%3==2) cout<<"h";
    else cout<<"i";
  }else if(t==5){
    if(m%3==1) cout<<"j";
    else if(m%3==2) cout<<"k";
    else cout<<"l";
  }else if(t==6){
    if(m%3==1) cout<<"m";
    else if(m%3==2) cout<<"n";
    else cout<<"o";
  }else if(t==7){
    if(m%4==1) cout<<"p";
    else if(m%4==2) cout<<"q";
    else if(m%4==3) cout<<"r";
    else cout<<"s";
  }else if(t==8){
    if(m%3==1) cout<<"t";
    else if(m%3==2) cout<<"u";
    else cout<<"v";
  }else if(t==9){
    if(m%4==1) cout<<"w";
    else if(m%4==2) cout<<"x";
    else if(m%4==3) cout<<"y";
    else cout<<"z";
  }
}
		     
int main(){
  string str;
  int n;
  cin>>n;
  int cou=0;
  for(int i=0;i<n;i++){
  cin>>str;
  for(int j=0;j<str.size();j++){
    if( j>0 && str[j]=='0' ){
	bo(str[j-1]-'0',cou);
      cou=0;
      continue;
    }
    else if(str[j]!='0') cou++;
  }
  cout<<endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
	int n; cin >> n;
	string dic[] ={" ", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
	for(int _=0; _<n; _++){
		string str; cin >> str;
		int cnt = -1;
		char val = '0';
		for(int i=0; i<str.size(); i++){
			if(str[i] == '0'){
				if(val == '0') continue;
				if(val == '1') cnt%=5;
				else if(val == '7' || val == '9') cnt %= 4;
				else cnt %= 3;
				cout << dic[val-'0'][cnt];
				cnt = -1;
				val = '0';
			} else{
				cnt++;
				val = str[i];
			}
		}
		cout << endl;
	}
}

C++: #include<cstdio>
#include<cstring>

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

int main(void) {
    char in[2000];
    int n;
    scanf("%d",&n);
    while(~scanf("%s", in)) {
        char c;
        int pos=0;
        while(c=in[pos]) {
            int i=0;
            while(c==in[pos+(++i)]);
            if(c-'0') printf("%c", map[c-'0'][(i-1)%strlen(map[c-'0'])]);
            pos += i;
        }
        printf("\n");
    }
    return 0;
}