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 <string>
#include <stack>
#include <queue>

using namespace std;

#define MAX 2048
string button[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};

int main(void) {
	int n, num = 0, count = 0;
	char nums[MAX];
	scanf("%d", &n);
	while(n--) {
		scanf("%s", nums);
		for(int i = 0; nums[i] != '\0'; i++) {
			if(nums[i] == '0') {
				if(num >= 1 && num <= 9) {
					printf("%c", button[num][(count + button[num].size() - 1) % button[num].size()]);
				}
				num = 0;
				count = 0;
			}
			else if(nums[i] == num + '0') {
				count++;
			} else {
				num = nums[i] - '0';
				count = 1;
			}
		}
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int lli;

string charset[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"}
};
int loop[10] = {0, 5, 3, 3, 3, 3, 3, 4, 3, 4};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	vector<string> ansvec;
	for (int n = 0; n < N; n++){
		string s;
		cin >> s;

		int i = 0;
		int push = -1;
		string ans = "";
		while (i < s.length()){
			int num = stoi(s.substr(i, 1));
			if (num != 0){
				int thisnum = num;
				while (num != 0){
					push++;
					i++;
					num = stoi(s.substr(i, 1));
				}
				ans += charset[thisnum][push % loop[thisnum]];
				push = -1;
			}
			i++;
		}
		ansvec.push_back(ans);
	}

	for (auto it = ansvec.begin(); it != ansvec.end(); it++){
		cout << *it << endl;
	}
	return 0;
}

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

#define PI 4*atan(1)
#define INF 1e8

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

vector<string> button = {".,!?",
           "abc",
           "def",
           "ghi",
           "jkl",
           "mno",
           "pqrs",
           "tuv",
           "wxyz"};


int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    string s;
    cin >> s;
    int cnt = 0;
    for(int j = 0; j < s.size(); j++){
      if(s[j] == '0'){
        if(cnt != 0){
          char c;
          int num = s[j-1] - '0';
          if(num - 1 == 0 && (cnt-1)%button[num-1].size() == 4)c = ' ';
          else c = button[num - 1][(cnt-1)%button[num-1].size()];
          cout << c;
          cnt = 0;
        }
      }else{
        cnt++;
      }
    }
    cout << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

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


int main(){
	int n,cnt,outcnt,inpcnt;
	char str[1025],outputStr[1025];
	
	cin>>n;
	
	for(int z=0;z<n;z++){
		
		fill(str,str+1025,'\0');
		fill(outputStr,outputStr+1025,'\0');
		cnt=-1;
		inpcnt=0;
		outcnt=0;
		
		cin>>str;
		
		while(true){
			if(str[inpcnt]=='\0'){
				break;
			}
			inpcnt++;
		}
		
		for(int i=0;i<inpcnt;i++){
			if(str[i]=='0'){
				if(i>0 && str[i-1]!='0'){
					outputStr[outcnt]=keibutton[str[i-1]-'0'][cnt];
					outcnt++;
				}
				cnt=-1;
			}
			else if(str[i]=='1'){
				if(cnt>=4){
					cnt=0;
				}
				else{
					cnt++;
				}
			}
			else if(str[i]=='7' || str[i]=='9'){
				if(cnt>=3){
					cnt=0;
				}
				else{
					cnt++;
				}
			}
			else{
				if(cnt>=2){
					cnt=0;
				}
				else{
					cnt++;
				}
			}
		}
		cout<<outputStr<<endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,q,l,r;
char d[200005],t[200005];
string s;

int main() {
	cout << fixed << setprecision(18);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		for(int j=0;j<s.length();j++){
			if(s[j]=='0'){continue;}
			long long int memo=(s[j]-'0'),cou=0;
			j++;
			while(s[j]!='0'){
				cou++;
				j++;
			}
			if(memo>=2&&memo<=6){
				cout<<(char)('a'+(memo-2)*3+cou%3);
			}else if(memo==7){
				cout<<(char)('p'+cou%4);
			}else if(memo==8){
				cout<<(char)('t'+cou%3);
			}else if(memo==9){
				cout<<(char)('w'+cou%4);
			}else if(memo==1){
				if(cou%5==0){
					cout<<'.';
				}else if(cou%5==1){
					cout<<',';
				}else if(cou%5==2){
					cout<<'!';
				}else if(cou%5==3){
					cout<<'?';
				}else if(cou%5==4){
					cout<<' ';
				}
				
			}
			
		}
		cout<<endl;
	}
}

C++: #include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
#define ck(n,a,b) (a<=(n)&&(n)<b)
using namespace std;

int main(){
	int N;
	cin>>N;
	string keitai[10]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	while(N--){
		string s;
		cin>>s;

		string ans="";
		int b=0,c=0;
		REP(i,0,(int)s.size()){
			if(s[i]=='0'){
				if(b!=0){
					int num=(c+keitai[b].size()-1)%keitai[b].size();
					ans.push_back(keitai[b][num]);
					b=0,c=0;
				}
			}
			else{
				b=s[i]-'0';
				c++;
			}
		}
		p(ans);
	}
	return 0;
}

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

int n;
char s[1030];
char list[9] = {'a', 'd', 'g', 'j', 'm', 'p', 't', 'w'};
char one[5] = {'.', ',', '!', '?', ' '};

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    char count = -1;
    bool flag = false;
    for (int j = 0; s[j] != 0; j++) {
      if (s[j] == '0') {
        if (!flag) continue;
        if (s[j-1] == '1') printf("%c", one[count % 5]);
        else if (s[j-1] == '7' || s[j-1] == '9') printf("%c", list[s[j-1] - '2'] + count % 4);
        else printf("%c", list[s[j-1] - '2'] + count % 3);
        flag = false;
        count = -1;
      } else {
        flag = true;
        count++;
        if (count == 60) count = 0;
      }
    }
    printf("\n");
  }
}