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 <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;
					}
				}	
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
vector<string> key={".,!? ","abc","def","ghi","jkl","mno",
					"pqrs","tuv","wxyz"};
int main(){
	int n;	cin>>n;
	while(n--){
		string s;	cin>>s;
		s+='0';
		string ret="";
		for(int i=1;i<s.size();i++){
			while(i<s.size()&&s[i]==s[i-1]&&s[i]=='0'){
				s.erase(s.begin()+i);
			}
		}
		while(s[0]=='0')	s.erase(s.begin());
		int type=s[0]-'0'-1;
		int push=0;
		for(int i=1;i<s.size();i++){
			if(type==s[i]-'0'-1)	push=(push+1)%key[type].size();
			else if(s[i]=='0'){
				ret+=key[type][push];
				if(i+1<s.size()){
					type=s[i+1]-'0'-1;
					push=-1;
				}
				else 	type=-1;
			}
			else{
				ret+=key[type][push];
				type=s[i]-'0'-1;
				push=0;
			}
		}
		if(type!=-1){
			ret+=key[type][push];
		}
		cout<<ret<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  for(int w=0;w<n;w++){
  string s;
  cin >> s;
  char flag;
  char c,ans;
  int p =0;
  for(int i=0;i<s.size();i++){
    c = s[i]-'0';
    if(c==0&&flag!=0){
       p = 0;
       cout << ans;
     }
    if(c==1){
      if(p%5==0) ans = '.';
      if(p%5==1) ans = ',';
      if(p%5==2) ans = '!';
      if(p%5==3) ans = '?';
      if(p%5==4) ans = ' ';
      p++;
    }
    if(c==2){
      if(p%3==0) ans = 'a';
      if(p%3==1) ans = 'b';
      if(p%3==2) ans = 'c';
      p++;
    }
    if(c==3){
      if(p%3==0) ans = 'd';
      if(p%3==1) ans = 'e';
      if(p%3==2) ans = 'f';
      p++;
    }
    if(c==4){
      if(p%3==0) ans = 'g';
      if(p%3==1) ans = 'h';
      if(p%3==2) ans = 'i';
      p++;
    }
    if(c==5){
      if(p%3==0) ans = 'j';
      if(p%3==1) ans = 'k';
      if(p%3==2) ans = 'l';
      p++;
    }
    if(c==6){
      if(p%3==0) ans = 'm';
      if(p%3==1) ans = 'n';
      if(p%3==2) ans = 'o';
      p++;
    }
    if(c==7){
      if(p%4==0) ans = 'p';
      if(p%4==1) ans = 'q';
      if(p%4==2) ans = 'r';
      if(p%4==3) ans = 's';
      p++;
    }
    if(c==8){
      if(p%3==0) ans = 't';
      if(p%3==1) ans = 'u';
      if(p%3==2) ans = 'v';
      p++;
    }
    if(c==9){
      if(p%4==0) ans = 'w';
      if(p%4==1) ans = 'x';
      if(p%4==2) ans = 'y';
      if(p%4==3) ans = 'z';
      p++;
    }
    flag = c;
  }
  cout << endl;
}
}

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

int main(){

  string s[]={""," .,!?", "cab", "fde", "igh", "ljk", "omn", "spqr", "vtu", "zwxy"};
  int m[]={0, 5, 3, 3, 3, 3, 3, 4, 3, 4};
  string b;
  int n, cnt;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>b;
    cnt=0;
    for(int j=0;j<b.size();j++){
      if(b[j]=='0'){
	if(cnt){
	  cout<<s[b[j-1]-'0'][cnt%m[b[j-1]-'0']];
	  cnt=0;
	}
      }else cnt++;
    }
    cout<<endl;
  }
  
  return 0;
}