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 <bits/stdc++.h>

//??????????????????????????????????????????
char key[10][6] = {
  {}, //0
  {5, '.', ',', '!', '?', ' '},
  {3, 'a', 'b', 'c'},
  {3, 'd', 'e', 'f'},
  {3, 'g', 'h', 'i'},
  {3, 'j', 'k', 'l'},
  {3, 'm', 'n', 'o'},
  {4, 'p', 'q', 'r', 's'},
  {3, 't', 'u', 'v'},
  {4, 'w', 'x', 'y', 'z'}
};
		 

int main(){

  int N;

  std::cin >> N;

  //??\????????\???????????°??????????????????????????¨???????????¨???????????????
  while(N){
    int row = 0;
    int count = -1;
  
    std::string str;
    std::cin >> str;

    for(int i = 0; i < (int)str.size(); i++){
      int num = str[i] - '0'; //???'??°???' - '0'??? ??§????????¨???????????°?????????int ?????????(ex: '1'-'0' = 1)

      if(num != 0){
	row = num;
	count++;
      }else{

	if(row != 0) //?????????0?????´???????°?????????????
	  std::cout << key[row][ (count % key[row][0]) + 1 ]; 
	
	row = 0;
	count = -1;
	/*??????????????§???????????????count???0????????????????????????key??????????????????cout%key[row][0]????????????????????¨
	  5550???????????????????????\?????¨???????????????0????????£?????????????????¬??????3????????£????????????????????¨????????????????????????*/
      }

    }

    std::cout << std::endl;

    N--;
    
  }
  return 0;
}

C++: #include<stdio.h>
#include<string.h>
char c[9][6]={".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
char s[1025];
int main(){
	int n,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf(" %s",s);
		int len=strlen(s);
		int p=-1;
		int cnt=0;
		for(j=0;j<len;j++){
			if(s[j]=='0'){
				if(p==-1)continue;
				if(p==0)cnt%=5;
				else if(p==6||p==8)cnt%=4;
				else cnt%=3;
				printf("%c",c[p][cnt]);
				p=-1;
				cnt=0;
			}else{
				if(p==-1)p=s[j]-'1';
				else cnt++;
			}
		}
		puts("");
	}
	return 0;
}

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

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

    int N;
    cin >> N;
    while (N--) {
        string s;
        cin >> s;
        int x = 0, cnt = 0;
        for (char c : s) {
            if (c == '0') {
                x--;
                cnt--;
                if (x != -1) {
                    cout << v[x][cnt % v[x].size()];
                }
                x = 0;
            } else {
                if (x == 0) {
                    x = c - '0';
                    cnt = 1;
                } else {
                    cnt++;
                }
            }
        }
        cout << endl;
    }
}

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

int main(){

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

  int n;
  cin >> n;
  while( n-- ){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
      if(s[i] == '0') continue;
      int j = 0;
      while( s[i+j] != '0' ) j++;
      cout << str[ (int)s[i+j-1]-'1' ][ (j-1)%str[ (int)s[i]-'1' ].size()];
      i += j;
    }
    cout << endl;
  }
	return 0 ;
}

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

string order;
vector<int> num;
vector<char> word;
int n;
char button[9][4] = {{'.',',','!','?'},{'a','b','c'},{'d','e','f'},{'g','h','i'},{'i','k','l'},{'m','n','o'},{'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};

int main()
{
  int but = 0,push = 0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> order;
    for(int j=0;j<order.size();j++){
      num.push_back((int)(order[j]-'0'));
    }
    for(int j=0;j<num.size();j++){
      if(1<=num[j] && num[j]<=9 && but==0){
	but = num[j];
      }else if(1<=num[j] && num[j]<=9 && but!=0){
	push++; //cout << "pushed" << endl;
      }else if(num[j]==0 && but && but!=1 && but!=7 && but!=9){
	word.push_back(button[but-1][push%3]); //cout << button[but-1][push%3] << endl;
	push = 0;
	but = 0;
      }else if(num[j]==0 && but && (but==1 || but==7 || but==9)){
	word.push_back(button[but-1][push%4]); //cout << button[but-1][push%4] << endl;
	push = 0;
	but = 0;
      }else if(num[j]==0 && !but){
	continue;
      }
    }
    for(int k=0;k<word.size();k++){
      cout << word[k];
    }
    cout << endl;
    word.clear();
    num.clear();
  }
  
  return 0;
  
}

C++: #include <cstdio>
#include <cstdlib>
#define STR_MAX 1025

int main () {
  int n;
  int data[ 10 ][ 6 ] = {
    { 0,   0,   0,   0,   0,   0 },
    { 5, '.', ',', '!', '?', ' ' },
    { 3, 'a', 'b', 'c',   0,   0 },
    { 3, 'd', 'e', 'f',   0,   0 },
    { 3, 'g', 'h', 'i',   0,   0 },
    { 3, 'j', 'k', 'l',   0,   0 },
    { 3, 'm', 'n', 'o',   0,   0 },
    { 4, 'p', 'q', 'r', 's',   0 },
    { 3, 't', 'u', 'v',   0,   0 },
    { 4, 'w', 'x', 'y', 'z',   0 }
  };
  scanf( "%d", &n );
  for( int i = 0; i < n; i++ ) {
    char instr[ STR_MAX ];
    char outstr[ STR_MAX ];
    int si = 0;
    int counter = 1;
    int tmp = 0;
    scanf( "%s", instr );
    for( int j = 0; instr[ j ] != '\0'; j++ ) {
      if( instr[ j ] == '0' ) {
        if( counter != 1 ){
          outstr[ si++ ] = tmp;
        }
        counter = 1;
        continue;
      }
      if( counter == data[ instr[ j ] - '0' ][ 0 ] + 1 ) {
        counter = 1;
      }
      tmp = data[ instr[ j ] - '0' ][ counter++ ];
    }
    outstr[ si++ ] = '\0';
    puts( outstr );
  }

  return EXIT_SUCCESS;
}