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++: # 2006.cc

#include <iostream>
#include <string>

using namespace std;

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

int main() {
?? int nnn;
?? cin >> nnn;
?? for (int iii = 0; iii < nnn; ++iii) {
?? ?? string input;
?? ?? cin >> input;
?? ?? int prev = 0, cnt = 0;
?? ?? for (char c : input) {
?? ?? ?? int d = c-'0';
?? ?? ?? if (d == 0) {
?? ?? ?? ?? if (prev != 0) {
?? ?? ?? ?? ??cout << chars[prev][(cnt-1) % chars[prev].size()];
?? ?? ?? ?? }
?? ?? ?? ?? cnt = 0;
?? ?? ?? } else {
?? ?? ?? ?? ++cnt;
?? ?? ?? }
?? ?? ?? prev = d;
?? ?? }
?? ?? cout << endl;
?? }
}

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

int N;
char phone[9][6] = {".,!? ","abc","def","ghi","jkl", "mno", "pqrs", "tuv","wxyz"};

int main(){
  cin >> N;
  
  for(int i=0; i<N; ++i){
    char input[1025];
    cin >> input;
    char old = '0';
    int count = 0;
    for(int j=0; input[j] != '\0'; ++j){
      if(input[j] == '0'){
        if(old != '0'){
          if('2' <= old && old <= '6'){
            putchar(phone[old-'1'][(count-1)%3]);
          }
          else if(old == '1'){
            putchar(phone[old-'1'][(count-1)%5]);
          }
          else{
            putchar(phone[old-'1'][(count-1)%4]);
          }
        }
        old = input[j];
        count = 0;
      }else{
        old = input[j];
        count++;
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<sstream>
#include<iomanip>
#include<stdlib.h>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<utility>
using namespace std;
#define loop(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);(i)++)
#define rloop(i,l,r) for(int (i)=(int)(l);(i)>(int)(r);(i)--)
#define rep(i,n) loop(i,0,n)
#define rrep(i,n) rloop(i,n-1,-1)
#define INF 0x3f3f3f3f
#define mod 1000000007
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

vector<string> split(stringstream& ss){
	string str;
	vector<string> res;
	while(ss>>str)res.push_back(str);
	return res;
}

int main(){
	int n,num;
	char table[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'}};
	string s;
	cin>>n;
	rep(i,n){
		cin>>s;
		num=0;
		rep(j,s.size()){
			if(s[j+1]=='0'){
				if(s[j]=='0')continue;
				else cout<<table[s[j]-'1'][s[j]-'1'==0?num%5:s[j]-'1'==6||s[j]-'1'==8?num%4:num%3];
				num=0;
			}else if(s[j+1]==s[j]){
				num++;
			}
		}
		cout<<endl;
	}
}

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;
  while(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;
}

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

int main() {
  string input;
  string trm = "cfilov";
  while (cin >> input) {
    char c = '\0';
    for (char btn : input) {
      if (c == '\0') {
        if (btn == '1') {
          c = '.';
        } else if (btn == '2') {
          c = 'a';
        } else if (btn == '3') {
          c = 'd';
        } else if (btn == '4') {
          c = 'g';
        } else if (btn == '5') {
          c = 'j';
        } else if (btn == '6') {
          c = 'm';
        } else if (btn == '7') {
          c = 'p';
        } else if (btn == '8') {
          c = 't';
        } else if (btn == '9') {
          c = 'w';
        }
      } else if (btn == '0') {
        cout << c;
        c = '\0';
      } else {
        if (c == 's' or c == 'z') {
          c -= 3;
        } else if (find(trm.begin(), trm.end(), c) != trm.end()) {
          c -= 2;
        } else if (c == '.') {
          c = ',';
        } else if (c == ',') {
          c = '!';
        } else if (c == '!') {
          c = '?';
        } else if (c == '?') {
          c = ' ';
        } else if (c == ' ') {
          c = '.';
        } else {
          c++;
        }
      }
    }
    cout << endl;
  }
}