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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 21

struct Data{
  int len;
  char c[5];
};

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


void calc(){
  string s,ans;
  vector<pair<int,int> > vec;
  
  cin >> s;

  int last = -1;
  for(int i=1;i<s.size();i++){
    if(s[i-1]!='0' && s[i]=='0') vec.push_back({i,i-(last+1)});
    if(s[i]=='0') last = i;
  }
  
  for(int i=0;i<vec.size();i++){
    ans += data[s[vec[i].first-1]-'0'][(vec[i].second-1)%(int)(data[s[vec[i].first-1]-'0'].size())];
  }
    
  cout << ans << endl;
  
  return;
}

int main(){
  int n;

  scanf("%d",&n);
  
  for(int i=0;i<n;i++){
    calc();
  }

  return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

vector<pair<int, int>> keitai(string s) {
	vector<pair<int, int>> v;
	int cnt = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '0') {
			if (cnt) v.push_back(make_pair(s[i - 1] - '0', cnt));
			cnt = 0;
		}
		else ++cnt;
	}

	return v;
}

char phone[10][10] = { {} ,{ '-','.',',','!','?',' ' },{ '-','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' } };


char ans(int a, int b) {
	if (a == 1) {
		b %= 5;
		if (b == 0)b=5;
	}
	else if (a == 7 || a == 9) {
		b %= 4;
		if (b == 0)b = 4;
	}
	else {
		b %= 3;
		if (b == 0)b = 3;
	}
	return phone[a][b];
}

int main() {
	int n;
	string s;

	cin >> n;

	while (n--) {
		cin >> s;

		vector<pair<int, int>> v = keitai(s);

		for (int i = 0; i < v.size(); ++i) {
			cout << ans(v[i].first, v[i].second);
		}
		cout << endl;
	}
}

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

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

	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main(){
  int n,i,j,k,p;
  string str;
  cin>>n;
  for(j=0;j<n;j++){
    cin >> str;
    p=0;
    char c;
    for(i=0;i<str.size();i++){
      if(str[i]=='0'){
	if(p!=0){
	  if(c=='1'){
	    if(p==1) cout << '.';
	    if(p==2) cout << ',';
	    if(p==3) cout << '!';
	    if(p==4) cout << '?';
	  }
	  if(c=='2'){
	    printf("%c", ('a'+(p-1)%3));
	  }
	  if(c=='3'){
	    printf("%c", ('d'+(p-1)%3));
	  }
	  if(c=='4'){
	    printf("%c", ('g'+(p-1)%3));
	  }
	  if(c=='5'){
	    printf("%c", ('j'+(p-1)%3));
	  }
	  if(c=='6'){
	   printf("%c", ('m'+(p-1)%3));
	  }
	  if(c=='7'){
	    printf("%c", ('p'+(p-1)%4));
	  }
	  if(c=='8'){
	    printf("%c", ('t'+(p-1)%3));
	  }
	  if(c=='9'){
	    printf("%c", ('w'+(p-1)%4));
	  }
	}
	p=0;
      }else{
	c=str[i];
	p++;
      }
      
    }
    cout << endl;
  }
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	string Botan[9] = { ".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
	int N; cin >> N;
	for (int i = 0; i < N;i++) {
		string str; cin >> str;
		int now = -1;
		int cnt = -1;
		for (int j = 0; j < str.length();j++) {
			if (str[j] == '0') {
				if (now == -1) continue;
				cout << Botan[now][cnt%Botan[now].size()];
				now = cnt = -1;
			}
			else {
				now = str[j] - '1';
				cnt++;
			}
		}
		cout << endl;
	}
}