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 <cstdio>
#include <vector>
using namespace std;

int main(void){
    vector<string> character;
    character.push_back("");
    character.push_back(".,!? ");
    character.push_back("abc");
    character.push_back("def");
    character.push_back("ghi");
    character.push_back("jkl");
    character.push_back("mno");
    character.push_back("pqrs");
    character.push_back("tuv");
    character.push_back("wxyz");

    int n;
    cin >> n;
    string s;
    for(int i = 0; i < n; i++){
        cin >> s;
        for(int j = 0; j < s.length(); j++){
            int index;
            for(index = j; s[index] != '0'; index++);
            int leng = index - j - 1;
            if(s[j] != '0'){ cout << character[s[j] - '0'][leng % character[s[j] - '0'].length()]; }
            j = index;
        }
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
vector<pair<int,int> > vpii(80);
string num;
void print(int s,int f){
  switch(f-48){
  case 1:switch(s%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(s%3){
    case 1:cout<<'a';break; case 2:cout<<'b';break; case 0:cout<<'c';break;}break;
  case 3:switch(s%3){
    case 1:cout<<'d';break;case 2:cout<<'e';break;case 0:cout<<'f';break;}break;
  case 4:switch(s%3){
    case 1:cout<<'g';break;case 2:cout<<'h';break;case 0:cout<<'i';break;} break;
  case 5:switch(s%3){
    case 1:cout<<'j';break;case 2:cout<<'k';break;case 0:cout<<'l';break;} break;
  case 6:switch(s%3){
    case 1:cout<<'m';break;case 2:cout<<'n';break;case 0:cout<<'o';break;} break;
  case 7:switch(s%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(s%3){
    case 1:cout<<'t';break;case 2:cout<<'u';break;case 0:cout<<'v';break;}break; 
  case 9:switch(s%4){
    case 1:cout<<'w';break;case 2:cout<<'x';break;case 3:cout<<'y';break;case 0:cout<<'z';break;}break;
  default :break; 
  }
}
int main(){
  int k=0,l=0,n;
  cin >> n;
  for(int q=0;q<n;q++){
    l=0;
    cin >> num;
    int a;
    for(int i=0;i<num.size();i++){
      if(i==0)
	a=num[0];
      k++;
      if(i!=0&&num[i]=='0' &&num[i-1]=='0'){
	k=0;
	continue;
      }else {
      if(num[i]!='0')
	a=num[i];
      if(num[i]=='0'){
	vpii[l]=make_pair(a,k-1);
	l++;
	k=0;
      }}
    }
    for(int j=0;j<l;j++){
      int w=0;
      print(vpii[j].second,vpii[j].first);
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;


string solve(string s){
    string ret="";
    char data[20][10]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    int d[20]={0,5,3,3,3,3,3,4,3,4};
    
    string tmp="";
    rep(i,s.sz){
        if(s[i]!='0'){
            tmp+=s[i];
        }
        else{
            if(tmp.sz>0){
                ret+=data[ tmp[0]-'0' ][(tmp.sz-1)%d[tmp[0]-'0']];
                tmp.clear();
            }
        }
    }
    return ret;
    
}

int main(){
    int n;
    cin>>n;
    rep(i,n){
        string s;
        cin>>s;
        cout<<solve(s)<<endl;
        
    }
    return 0;
}

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

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