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 <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

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

int main(void){
	int n;
	cin >> n;
	rep(k,n){
		string L;
		cin >> L;
		int count = 0;
		for(int i = 0; i < L.size(); i++){
			if(L[i] == '0'){
				if(count == 0)continue;
				int type = L[i-1]-'0';
				if(L[i] != '0')cout << s[type][(count-1)%s[type].size()];
				count = 0;
				continue;
			}
		}
		cout << endl;
	}
	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

C++: #include<iostream>

using namespace std;

string str;

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

void solve() {
    cin>>str;
    char c = '\0';
    int cnt=-1;
    int num=0;

    for(int i=0;i<str.size();i++) {
        
        if(str[i]=='0') {
            if(cnt==-1) c='\0';
            else c=keys[num-1][cnt];
            if(c!='\0') cout<<(c);
            c='\0';
            cnt=-1;
            num=0;
        }
        else {
            num=str[i]-'0';
            cnt++;
            cnt%=keys[num-1].size();            
        }
    }
    cout<<endl;
}

int main() {
    int n;
    cin>>n;
    for(int i=0;i<n;i++) {
        solve();
    }

    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
string btn[10]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
typedef pair<int,int> P;
int main(){
	string in;
	for(cin>>in;cin>>in;){
		string res;
		P b=P(0,0);
		for(int i=0;i<(int)in.size();i++){
			if(b.first==0&&in[i]>'0'){
				b.first=in[i]-'0';b.second=0;
			}else if(b.first==in[i]-'0'){
				b.second++;
			}else if(in[i]=='0'&&b.first>0){
				res+=btn[b.first][b.second%btn[b.first].size()];
				b=P(0,0);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
int i;
cin>>i;
int n;
string s;
int n1=0,n2=0,n3=0,n4=0,n5=0,n6=0,n7=0,n8=0,n9=0;
for(int j=0;j<i;j++){
  cin>>n;
do{
switch(n){
  case 1:
  n1++;
  break;
  case 2:
  n2++;
  break;
  case 3:
  n3++;
  break;
  case 4:
  n4++;
  break;
  case 5:
  n5++;
  break;
  case 6:
  n6++;
  break;
  case 7:
  n7++;
  break;
  case 8:
  n8++;
  break;
  case 9:
  n9++;
  break;
  default:
  if(n1){
    if(n1==1){
      cout<<'.';
    }
    else if(n1==2){
      cout<<',';
    }
    else if(n1==3){
      cout<<'!';
    }
    else{
      cout<<'?';
    }
    n1=0;
  }
  else if(n2){
    if(n2==1){
      cout<<'a';
    }
    else if(n2==2){
      cout<<'b';
    }
    else{
      cout<<'c';
    }
    n2=0;
  }
  else if(n3){
    if(n3==1){
      cout<<'d';
    }
    else if(n3==2){
      cout<<'e';
    }
    else{
      cout<<'f';
    }
    n3=0;
  }
  else if(n4){
    if(n4==1){
      cout<<'g';
    }
    else if(n4==2){
      cout<<'h';
    }
    else{
      cout<<'i';
    }
    n4=0;
  }
  else if(n5){
    if(n5==1){
      cout<<'j';
    }
    else if(n5==2){
      cout<<'k';
    }
    else{
      cout<<'l';
    }
    n5=0;
  }
  else if(n6){
    if(n6==1){
      cout<<'m';
    }
    else if(n6==2){
      cout<<'n';
    }
    else{
      cout<<'o';
    }
    n6=0;
  }
  else if(n7){
    if(n7==1){
      cout<<'p';
    }
    else if(n7==2){
      cout<<'q';
    }
    else if(n7==3){
      cout<<'r';
    }
    else{
      cout<<'s';
    }
    n7=0;
  }
  else if(n8){
    if(n8==1){
      cout<<'t';
    }
    else if(n8==2){
      cout<<'u';
    }
    else{
      cout<<'v';
    }
    n8=0;
  }
  else if(n9){
    if(n9==1){
      cout<<'w';
    }
    else if(n9==2){
      cout<<'x';
    }
    else if(n9==3){
      cout<<'y';
    }
    else{
      cout<<'z';
    }
    n9=0;
  }
}
}while(cin>>n);
}
}

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){//０まで
	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;
}