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 <cstdlib>
#include <string>
#include <vector>

void make_table(std::vector<std::vector<char> > &table) {
    int i;
    int j;
    table[1].push_back(46); 
    table[1].push_back(44); 
    table[1].push_back(33); 
    table[1].push_back(63); 
    table[1].push_back(32); 
    for (i = 2; i <= 7; i++) {
        for (j = 0; j <= 2; j++) {
            table[i].push_back(97 + 3 * (i - 2) + j); 
        }
    }
    table[7].push_back(115);
    for (i = 8; i <= 9; i++) {
        for (j = 0; j <= 2; j++) {
            table[i].push_back(116 + 3 * (i - 8) + j); 
        }
    }
    table[9].push_back(122);
}

int main(void) {
    int n;
    std::string s;
    const char* c;
    char now_num;
    int now_count;
    std::vector<std::vector<char> >  table(10, std::vector<char>());
    make_table(table);

    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> s;
        c = s.c_str();
        now_count = 0;
        now_num = c[0];
        //std::cout << "SSIZE = " << s.size() << std::endl;
        for (int j = 0; j < s.size(); j++) {
            if (c[j] == now_num) {
                now_count++;
            } else {
                if (c[j] == '0') {
                    //std::cout << "C = " << c[j] << std::endl;
                    //std::cout << "NUM = " << now_num << std::endl;
                    //std::cout << "COUNT = " << now_count << std::endl;
                    int amari = now_count % table[(int)now_num - 48].size() - 1;
                    if (amari == -1) {
                        amari += table[(int)now_num - 48].size();
                    }
                    std::cout << table[(int)now_num - 48][amari];
                }
                if (j != s.size() - 1) {
                    now_num = c[j];
                }
                now_count = 1;
            }
        }
        std::cout << std::endl;
    }

    return EXIT_SUCCESS;
}

C++: #include<iostream>
using namespace std;
const char button[10][6] = {	{},
								{'.',',','!','?',' '},
								{'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 num[10] = {0,5,3,3,3,3,3,4,3,4};
int main()
{
	int n;
	cin >> n;
	char line[1024];
	for (int i = 0; i < n; i++)
	{
		cin >> line;
		int len = strlen(line);
		int j = 0;
		while (j < len)
		{
			int next = j + 1;
			int count = 0;
			while(next < len  && line[next] == line[j])
			{
				next++;
				count++;
			}
			if ((line[j] - '0') != 0)
			{
				int number = line[j] - '0';
				int length = num[number];
				cout << button[number][count % length];
			}
			count = 0;
			j = next;
		}
		cout<<endl;

	}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    string S;
    cin >> S;
    map<char,int> loop;
    map<char,map<int,char> > mp;
    mp['1'][0]='.';loop['1']=5;
    mp['1'][1]=',';
    mp['1'][2]='!';
    mp['1'][3]='?';
    mp['1'][4]=' ';
    mp['2'][0]='a';loop['2']=3;
    mp['2'][1]='b';
    mp['2'][2]='c';
    mp['3'][0]='d';loop['3']=3;
    mp['3'][1]='e';
    mp['3'][2]='f';
    mp['4'][0]='g';loop['4']=3;
    mp['4'][1]='h';
    mp['4'][2]='i';
    mp['5'][0]='j';loop['5']=3;
    mp['5'][1]='k';
    mp['5'][2]='l';
    mp['6'][0]='m';loop['6']=3;
    mp['6'][1]='n';
    mp['6'][2]='o';
    mp['7'][0]='p';loop['7']=4;
    mp['7'][1]='q';
    mp['7'][2]='r';
    mp['7'][3]='s';
    mp['8'][0]='t';loop['8']=3;
    mp['8'][1]='u';
    mp['8'][2]='v';
    mp['9'][0]='w';loop['9']=4;
    mp['9'][1]='x';
    mp['9'][2]='y';
    mp['9'][3]='z';
    char set='0';
    int count=0;
    for(int i=0;i<S.size();i++){
      if(S[i]=='0'){
        if(set!='0'){
          cout << mp[set][count%loop[set]];
          set='0';
        }
        count = 0;
      }else if(S[i]==set){
        count++;
      }else{
        set=S[i];
      }
    }
    cout << endl;
  }
}

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

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

using namespace std;

int main(){
    string keitai[10] =
        {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    string str;
    int n; cin >> n;
    REP(k,n){
        cin >> str;
        int len = str.size();
        int cur=0, cnt=0;
        int tmp;
        REP(i,len){
            if(str[i]=='0'){ //00???????????¨???cnt=0
                if(cnt!=0){
                    if(cnt % keitai[cnt].size()==0){
                        tmp = keitai[cnt].size() - 1;
                    }else{
                        tmp = cnt % keitai[cnt].size() - 1;
                    }
                    cout << keitai[cur][tmp];
                }
                cur=0; cnt=0;
            }else{ //str[i]!='0'
                if(cur==0){//0??\?????\????????????
                    cur = str[i] - '0';
                    cnt++;
                }else{
                    cnt++;
                }
            }
        }
    }
    cout << endl;
    return 0;
}