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 <map>
using namespace std;

map<char, string> convert_table;

void init() {
    convert_table['1'] = ".,!? ";
    convert_table['2'] = "abc";
    convert_table['3'] = "def";
    convert_table['4'] = "ghi";
    convert_table['5'] = "jkl";
    convert_table['6'] = "mno";
    convert_table['7'] = "pqrs";
    convert_table['8'] = "tuv";
    convert_table['9'] = "wxyz";
}

char convert(char c, int n) {
    n = (n-1) % convert_table[c].size();
    return convert_table[c][n];
}

int main() {
    init();
    int n;
    cin >> n; getchar();
    for (int i = 0; i < n; i++) {
        string s, t;
        getline(cin, s);
        char prev = s[0];
        int count = 1;
        for (int j = 1; j < s.size(); j++) {
            if (s[j] == prev) {
                count++;
            } else if (s[j] == '0') {
                if (prev == '0') {
                    continue;
                } else {
                    t.push_back(convert(prev, count));
                    prev = s[j];
                    count = 0;
                } 
            } else {
                prev = s[j];
                count = 1;
            }
        }
        cout << t << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		int ans=0;
		int j=0;
		while(j<s.size()){
			int cnt=0;
			int t=0;
			while(s[j+t+1]!='0'){
				if(s[j]=='0')break;
				t++;
			}
			if(s[j]=='1'){
				if((t+1)%5==1){
					cout<<".";
				}
				if((t+1)%5==2){
					cout<<",";
				}
				if((t+1)%5==3){
					cout<<"!";
				}
				if((t+1)%5==4){
					cout<<"?";
				}
				if((t+1)%5==0){
					cout<<" ";
				}
			}
			if(s[j]=='2'){
				if((t+1)%3==1){
					cout<<"a";
				}
				if((t+1)%3==2){
					cout<<"b";
				}
				if((t+1)%3==0){
					cout<<"c";
				}
			}
			if(s[j]=='3'){
				if((t+1)%3==1){
					cout<<"d";
				}
				if((t+1)%3==2){
					cout<<"e";
				}
				if((t+1)%3==0){
					cout<<"f";
				}

			}
			if(s[j]=='4'){
				if((t+1)%3==1){
					cout<<"g";
				}
				if((t+1)%3==2){
					cout<<"h";
				}
				if((t+1)%3==0){
					cout<<"i";
				}
			}
			if(s[j]=='5'){
				if((t+1)%3==1){
					cout<<"j";
				}
				if((t+1)%3==2){
					cout<<"k";
				}
				if((t+1)%3==0){
					cout<<"l";
				}
			}
			if(s[j]=='6'){
				if((t+1)%3==1){
					cout<<"m";
				}
				if((t+1)%3==2){
					cout<<"n";
				}
				if((t+1)%3==0){
					cout<<"o";
				}
			}
			if(s[j]=='7'){
				if((t+1)%4==1){
					cout<<"p";
				}
				if((t+1)%4==2){
					cout<<"q";
				}
				if((t+1)%4==3){
					cout<<"r";
				}
				if((t+1)%4==0){
					cout<<"s";
				}
			}
			if(s[j]=='8'){
				if((t+1)%3==1){
					cout<<"t";
				}
				if((t+1)%3==2){
					cout<<"u";
				}
				if((t+1)%3==0){
					cout<<"v";
				}
			}
			if(s[j]=='9'){
				if((t+1)%4==1){
					cout<<"w";
				}
				if((t+1)%4==2){
					cout<<"x";
				}
				if((t+1)%4==3){
					cout<<"y";
				}
				if((t+1)%4==0){
					cout<<"z";
				}
			}
			j+=t+1;
			
		}
		cout<<endl;
	}
	return 0;
}

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

using namespace std;
int main(){
  char m[9][5]={{'.',',','!','?',' '},
		{'a','b','c','1','1'},
		{'d','e','f','1','1'},
		{'g','h','i','1','1'},
		{'j','k','l','1','1'},
		{'m','n','o','1','1'},
		{'p','q','r','s','1'},
		{'t','u','v','1','1'},
		{'w','x','y','z','1'}};

  int a,count=0,c[100],d;
  char b[100000000000000][1025];
  cin>>a;
  for(int i=0;i<a;i++){
    scanf("%s",b[i]);
    c[i]=strlen(b[i]);
    for(int j=0;j<c[i];j++){
      if(b[i][j]!='0')count++;
      else
	if(b[i][j-1]!=0){
	  d=(int)(b[i][j-1])-48;

	  if(d==1)
	    if(count%5!=0)
	      cout<<m[d-1][count%5-1];
	    else cout<<m[d-1][4];

	  else if(d==7 || d==9)
	    if(count%4!=0)
	      cout<<m[d-1][count%4-1];
	    else cout<<m[d-1][3];

	  else
	    if(count%3!=0)
	      cout<<m[d-1][count%3-1];
	    else cout<<m[d-1][2]; 
	  count=0;
	}
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

int main() {
  vector<string> vec(10);
  vec[1] = ".,!? ";
  vec[2] = "abc";
  vec[3] = "def";
  vec[4] = "ghi";
  vec[5] = "jkl";
  vec[6] = "mno";
  vec[7] = "pqrs";
  vec[8] = "tuv";
  vec[9] = "wxyz";

  i64 n;
  cin >> n;
  rep(q, 0, n) {
    string s;
    cin >> s;
    i64 cnt = -1;
    string ans = "";
    rep(i,0,s.size()) {
      if(s[i] == '0') {
        if(cnt >= 0) {
          auto& v = vec[s[i - 1] + 1 - '1'];
          ans.push_back(v[cnt % v.size()]);
        }
        cnt = -1;
      }
      else {
        cnt++;
      }
    }
    cout << ans << endl;
  }
}

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

using std::cin;
using std::cout;
using std::endl;

char keitai[][6] =
{
	".,!? ",	
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz"
};

char out_keitai(int num, int count) {
	if (num == 1) {
		if (count%5 != 0) {
			return keitai[num-1][(count%5)-1];
		}else {
			return keitai[num-1][4];
		}
	}else if (num == 7 || num == 9) {
		if (count%4 != 0) {
			return keitai[num-1][(count%4)-1];
		}else {
			return keitai[num-1][3];
		}
	}else {
		if (count%3 != 0) {
			return keitai[num-1][(count%3)-1];
		}else {
			return keitai[num-1][2];
		}
	}
}
int main(void) {
	int n;
	char inp;
	std::string str;

	cin >> n;
	cin.ignore(2);

	for (int i = 0; i < n; i++) {
		getline(cin, str);
		int num;
		int count = 0;
		for (int j = 0; j < str.length(); j++) {
			std::string dstr;
			dstr = str.substr(j,1);
			num = atoi(dstr.c_str());
			if (num != 0) {
				count++;
				int seq = 1;
				int next_num;
				while (seq) {
					dstr = str.substr(j+1,1);
					next_num = atoi(dstr.c_str());
					if (num == next_num) {
						count++;
						j++;
					}else {
						seq = 0;
						cout << out_keitai(num,count);
						count = 0;
					}
				}	
			}
		}
		if (i != n-1) {
			cout << endl;
		}
	}
	return 0;
}