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<vector>
#include<string>
using namespace std;
int main() {
	int n;
	const char b[9][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'} };
	const int a[] = {5,3,3,3,3,3,4,3,4};
	cin >> n;
	for(int i=0;i<n;++i){
		string buf;
		cin >> buf;
		int c,j=0;
		bool f = false;
		int cnt = 0;
		while((c=buf[j++])!='\0'){
			c -= '0';
			int tmp;
			if(c==0){
				if(f){
					cout << b[tmp-1][--cnt%a[tmp-1]];
					cnt=0;
					f=false;
				}
			}else{
				tmp=c; cnt++; f=true;
			}
		}
		cout << endl;
	}
	return 0;
}

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

char const mozi1[]={'.',',','!','?',' '},mozi2[]={'a','b','c'},mozi3[]={'d','e','f'},mozi4[]={'g','h','i'},mozi5[]={'j','k','l'},mozi6[]={'m','n','o'},mozi7[]={'p','q','r','s'},mozi8[]={'t','u','v'},mozi9[]={'w','x','y','z'};
void henkan(char *);
char mozi(int,char);
int main(){
	int n;
	cin>>n;

	for(int i=0;i<n;i++){
		char * keitai=new char[1024];
		cin>>keitai;
		henkan(keitai);
		delete[]keitai;
	}
	return 0;
}

void henkan(char * keitai){
	char *hyouzi=new char[72];
	fill(hyouzi,hyouzi+72,NULL);
	int length=strlen(keitai);
	int cnt=0;
	
	for(int i=0;i<length;i++){
		if(keitai[i]=='0')	continue;
		else{
			int kazu=1;
			while(keitai[i+1]!='0'){
				kazu++;
				i++;
			}
			hyouzi[cnt]=mozi(kazu,keitai[i]);
			i++;
			cnt++;
		}
	}
	
	cout<<hyouzi<<endl;
	delete[] hyouzi;
	return;
}
char mozi(int kazu,char keitai){
	switch (keitai)
	{
	case '1':
		kazu=kazu%5-1;
		if(kazu==-1)	return mozi1[4];
		return mozi1[kazu];
		
	case '2':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi2[2];
		return mozi2[kazu];
		
	case '3':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi3[2];
		return mozi3[kazu];
		
	case '4':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi4[2];
		return mozi4[kazu];
		
	case '5':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi5[2];
		return mozi5[kazu];
		
	case '6':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi6[2];
		return mozi6[kazu];
		
	case '7':
		kazu=kazu%4-1;
		if(kazu==-1)	return mozi7[3];
		return mozi7[kazu];
		
	case '8':
		kazu=kazu%3-1;
		if(kazu==-1)	return mozi8[2];
		return mozi8[kazu];
		
	case '9':
		kazu=kazu%4-1;
		if(kazu==-1)	return mozi9[3];
		return mozi9[kazu];
	default:
		return '0';
	}
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n;
  cin >> n;
  string ss[9] = {".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs"
                   ,"tuv", "wxyz"};
  while(n--) {
    string s;
    cin >> s;
    char n = '*';
    int ct = 0;
    REP(i,s.size()) {
//      printf("%c, %d\n", n, ct);
      if (s[i] == '0') {
        if (ct > 0) {
          cout << ss[n-'1'][(ct-1) % ss[n-'1'].size()];
        }
        ct = 0; n = '*';
      } else if (s[i] != n) {
        n = s[i];
        ct = 1;
      } else {
        ++ct;
      }
    }
    cout << endl;
  }
}

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

void out(char num, int times){
    switch(num){
        case '1':
            switch(times%5){
                case 1: cout << '.'; break;
                case 2: cout << ','; break;
                case 3: cout << '!'; break;
                case 4: cout << '?'; break;
                case 0: cout << ' '; break;
            }
            break;
        case '2':
            switch(times%3){
                case 1: cout << 'a'; break;
                case 2: cout << 'b'; break;
                case 0: cout << 'c'; break;
            }
            break;
        case '3':
            switch(times%3){
                case 1: cout << 'd'; break;
                case 2: cout << 'e'; break;
                case 0: cout << 'f'; break;
            }
            break;
        case '4':
            switch(times%3){
                case 1: cout << 'g'; break;
                case 2: cout << 'h'; break;
                case 0: cout << 'i'; break;
            }
            break;
        case '5':
            switch(times%3){
                case 1: cout << 'j'; break;
                case 2: cout << 'k'; break;
                case 0: cout << 'l'; break;
            }
            break;
        case '6':
            switch(times%3){
                case 1: cout << 'm'; break;
                case 2: cout << 'n'; break;
                case 0: cout << 'o'; break;
            }
            break;
        case '7':
            switch(times%4){
                case 1: cout << 'p'; break;
                case 2: cout << 'q'; break;
                case 3: cout << 'r'; break;
                case 0: cout << 's'; break;
            }
            break;
        case '8':
            switch(times%3){
                case 1: cout << 't'; break;
                case 2: cout << 'u'; break;
                case 0: cout << 'v'; break;
            }
            break;
        case '9':
            switch(times%4){
                case 1: cout << 'w'; break;
                case 2: cout << 'x'; break;
                case 3: cout << 'y'; break;
                case 0: cout << 'z'; break;
            }
            break;
        case '0': break;
    }
}

int main(void){
    int n;
    cin >> n;
    for(int i=0;i<n;++i){
        char str[1050];
        cin >> str;
        for(int j=0;j<strlen(str);++j){
            int cnt = 0;
            char num = str[j];
            while(true){
                if(str[j+cnt]=='0') break;
                ++cnt;
            }
            out(num, cnt);
            j += cnt;
        }
        cout << endl;
    }
}