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++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

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


int main(){
  char buf[1025];
  int N;
  while(~scanf("%d",&N)){
    for(int t=0;t<N;t++){
      scanf("%s",buf);
      queue<int> que;
      for(int i=0;i<strlen(buf);i++){
	if(buf[i] != '0') que.push(buf[i]-'0');
	else if(buf[i] == '0'){
	  if(que.empty()) continue;
	  int idx = que.size()-1;
	  int key = que.front();
	  int pos = idx%strlen(gKeys[key]);
	  printf("%c",gKeys[key][pos]);
	  que = queue<int>(); //clear que
	}
      }
      printf("\n");
    }
  }
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
#define d_arr(arr, h, w) rep(i,(h) ){ cout << "["; rep(j,(w) ) { cout << (arr)[i][j] << ", "; } cout << "]" << endl;}

typedef pair<int ,int> P;

/*
1: . , ! ? (スペース)
2: a b c
3: d e f
4: g h i
5: j k l
6: m n o
7: p q r s
8: t u v
9: w x y z
0: 確定ボタン
 */

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


int main()
{
    int n;
    int index;
    int count=0;
    string s;
    int loop;
    cin >> loop;
    rep(i, loop)
    {
        string s;
        cin >> s;
        cout << s << endl;
        rep(j, s.size() )
        {
            string st;
            st[0] = s[j];
            n = atoi( &st[0] );
            //cout << n << endl;
            if( n == 0 && count == 0) { continue; }
            else if( n == 0 ) 
            { 
                cout << a[index - 1][(count - 1) % a[index - 1].size() ];  
                count = 0;
            }
            else
            {
                index = n;
                count++;
            }
        }
    }
    //if ( count > 0 ) { cout << a[index - 1][(count - 1) % 9]; count = 0; }
}

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

int main()
{
  string data[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
  int n;
  cin >> n;

  while( n-- ) {
    string s;
    cin >> s;

    int now_p = -1;
    char now_c = '0';
    for(int i=0; i<s.size(); i++) {
      if( s[i] == '0' ) {
	if( now_c == '0' ) continue;
	else {
	  cout << data[now_c-'0'][now_p];
	  now_c = '0';
	  now_p = -1;
	}
      } 
      else {
	now_c = s[i];
	now_p++;
	if( now_p >= data[now_c-'0'].size() ) {
	  now_p = 0;
	}
      }
    }

    cout << endl;
  }
}

C++: #include<iostream>
#include<string>
using namespace std;
string search(int n[]) {
	if (n[0]) {
		if (n[0] == 1) {
			n[0] = 0;
			return ".";
		}
		else if (n[0] == 2) {
			n[0] = 0;
			return ",";
		}
		else if (n[0] == 3) {
			n[0] = 0;
			return "!";
		}
		else {
			n[0] = 0;
			return "?";
		}
	}
	else if (n[1]) {
		if (n[1] % 3 == 1) {
			n[1] = 0;
			return "a";
		}
		else if (n[1] % 3 == 2) {
			n[1] = 0;
			return "b";
		}
		else {
			n[1] = 0;
			return "c";
		}
	}
	else if (n[2]) {
		if (n[2] % 3 == 1) {
			n[2] = 0;
			return "d";
		}
		else if (n[2] % 3 == 2) {
			n[2] = 0;
			return "e";
		}
		else {
			n[2] = 0;
			return "f";
		}
	}
	else if (n[3]) {
		if (n[3] % 3 == 1) {
			n[3] = 0;
			return "g";
		}
		else if (n[3] % 3 == 2) {
			n[3] = 0;
			return "h";
		}
		else {
			n[3] = 0;
			return "i";
		}
	}
	else if (n[4]) {
		if (n[4] % 3 == 1) {
			n[4] = 0;
			return "j";
		}
		else if (n[4] % 3 == 2) {
			n[4] = 0;
			return "k";
		}
		else {
			n[4] = 0;
			return "l";
		}
	}
	else if (n[5]) {
		if (n[5] % 3 == 1) {
			n[5] = 0;
			return "m";
		}
		else if (n[5] % 3 == 2) {
			n[5] = 0;
			return "n";
		}
		else {
			n[5] = 0;
			return "o";
		}
	}
	else if (n[6]) {
		if (n[6] % 4 == 1) {
			n[6] = 0;
			return "p";
		}
		else if (n[6] % 4 == 2) {
			n[6] = 0;
			return "q";
		}
		else if (n[6] % 4 == 3) {
			n[6] = 0;
			return "r";
		}
		else {
			n[6] = 0;
			return "s";
		}
	}
	else if (n[7]) {
		if (n[7] % 3 == 1) {
			n[7] = 0;
			return "t";
		}
		else if (n[7] % 3 == 2) {
			n[7] = 0;
			return "u";
		}
		else {
			n[7] = 0;
			return "v";
		}
	}
	else if (n[8]) {
		if (n[8] % 4 == 1) {
			n[8] = 0;
			return "w";
		}
		else if (n[8] % 4 == 2) {
			n[8] = 0;
			return "x";
		}
		else if (n[8] % 4 == 3) {
			n[8] = 0;
			return "y";
		}
		else {
			n[8] = 0;
			return "z";
		}
	}
	return "";
}


int main() {
	int i;
	cin >> i;
	string num;
	string s;
	int n[9] = {};
	for (int j = 0; j<i; j++) {
		cin >> num;
		for (int j = 0; j < num.size() ; j++) {
			switch (num[j]) {
			case '1':
				if (n[0] == 0)s += search(n);
				n[0]++;
				break;
			case '2':
				if (n[1] == 0)s += search(n);
				n[1]++;
				break;
			case '3':
				if (n[2] == 0)s += search(n);
				n[2]++;
				break;
			case '4':
				if (n[3] == 0)s += search(n);
				n[3]++;
				break;
			case '5':
				if (n[4] == 0)s += search(n);
				n[4]++;
				break;
			case '6':
				if (n[5] == 0)s += search(n);
				n[5]++;
				break;
			case '7':
				if (n[6] == 0)s += search(n);
				n[6]++;
				break;
			case '8':
				if (n[7] == 0)s += search(n);
				n[7]++;
				break;
			case '9':
				if (n[8] == 0)s += search(n);
				n[8]++;
				break;
			default:
				if (n[0]) {
					s += search(n);
				}
				else if (n[1]) {
					s += search(n);
				}
				else if (n[2]) {
					s += search(n);
				}
				else if (n[3]) {
					s += search(n);
				}
				else if (n[4]) {
					s += search(n);
				}
				else if (n[5]) {
					s += search(n);
				}
				else if (n[6]) {
					s += search(n);
				}
				else if (n[7]) {
					s += search(n);
				}
				else if (n[8]) {
					s += search(n);
				}
			}
		}
		cout << s << endl;
		s = "";
	}
}