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>
#define REP(i, n) for(int i = 0; i < (n); i++)

using namespace std;

int main()
{
  char keitai[10][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;
  int x , c;
  char p;
  while(getline(cin, s)){
    x = c = 0;
    p = '\0';
    REP(i, s.size()){
      int j;
      j = s[i] - '0';
      if(j){
        if(x == j){
          if(keitai[j][c + 1] == '*'){
            c = 0;
            p = keitai[j][c];
          }else{
            c++;
            p = keitai[j][c];
            //cout << "i = " << i << ", p = " << p << endl;
          }
        }else{
          c = 0;
          p = keitai[j][c];
        }
      }else{
        if(p != '\0')
          cout << p;
        p = '\0';
      }
      x = j;
    }
    cout << endl;
  }
}

C++: #include <iostream>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

int T;
string S;

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

int main(void) {
  cin >> T;
  while(T--) {
    cin >> S;
    string ans = "";
    REP(i, 0, S.length()) {
      if(S[i] == '0') continue;
      int j;
      for(j = i; S[j] != '0'; j++);
      int n = S[i] - '0';
      int p = (j - i - 1) % mod[n];
      int k = key[n][p];
      ans += k;
      i = j;
    }
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

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

	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		string s;
		string ret;
		cin >> s;
		char current = s[0];
		int count = 0;
		for (int unsigned i = 0; i < s.size(); i++){
			if (s[i] == '0'){
				if (count == 0) continue;
 				int it = (int)(current - '0') - 1;
				cout << button[it][(count -1) % button[it].size()];
				count = 0;
			}
			else {
				current = s[i];
				count++;
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    string botun[] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
 
        string ans=""; 
        int btn=0,count=0;
        for(int j=0;j<s.size();j++){
            if(btn ==0 &&(int)s[j]>0){
                btn=s[j]-'0';
                count=0;
            }else if(btn==(int)s[j]-'0'){
                count++;
            }else if((int)s[j]-'0'==0&&btn>0){
                ans += botun[btn][count % botun[btn].size()];
                btn=0;
                count=0;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<bitset>
#include<map>
using namespace std;

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


string s;
bool input(){
  s="";
  if(!(cin>>s)){
    return false;
  }
  return true;
}


string solve(){
  string res = "";
  int n=-1;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0'){
      if(n==-1||i==0)continue;
      int tmp = s[i-1]-'0';
      res += list[tmp-1][n%list[tmp-1].size()];
      n=-1;
    }else{
      n++;
    }
  }
  return res;
}

int main(){
  int c;
  cin>>c;
  for(int i=0;i<c;i++){
    input();
    string ans = solve();
    if(ans.size()!=0)cout<<ans<<endl;
  }
}