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> // C++の入出力
#include <stdio.h> // C の入出力
#include <algorithm> // sort などのアルゴリズム
#include <string.h> // C の文字列用
#include <ctype.h> // C の文字種用
#include <string> // C++の文字列
#include <math.h>
#include <sstream>

using namespace std;
int main(void){
    int n;
    cin>>n;
    string out1=".,!? ";
    string out2="abc";
    string out3="def";
    string out4="ghi";
    string out5="jkl";
    string out6="mno";
    string out7="pqrs";
    string out8="tuv";
    string out9="wxyz";
    for(int s=0;s<n;s++){
        string in;
        cin>>in;
        int cnt=0;
        for(int i=0;i<in.length();i++){
            switch (in[i]-'0') {
                case 0:
                    switch (in[i-1]-'0') {
                        case 1:
                            cout<<out1[(cnt-1)%5];
                            break;
                        case 2:
                            cout<<out2[(cnt-1)%3];
                            break;
                        case 3:
                            cout<<out3[(cnt-1)%3];
                            break;
                        case 4:
                            cout<<out4[(cnt-1)%3];
                            break;
                        case 5:
                            cout<<out5[(cnt-1)%3];
                            break;
                        case 6:
                            cout<<out6[(cnt-1)%3];
                            break;
                        case 7:
                            cout<<out7[(cnt-1)%4];
                            break;
                        case 8:
                            cout<<out8[(cnt-1)%3];
                            break;
                        case 9:
                            cout<<out9[(cnt-1)%4];
                            break;
                        case 0:
                            break;
                    }
                    cnt=0;
                    break;
                default:
                    cnt++;
                    break;
            }
        }
        if(in=="0")cout<<"";
        else cout<<endl;
    }
    return 0;
}

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

using namespace std;

#define NMAX 123456

int main(){

	string S[10]={"NULL",".,!?","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	string in;
	int N;

	cin>>N;
	while(N--){
		cin>>in;
		int c;
		if(in[0]=='0') c=0;
		else c=1;
		for(int i=1;i<in.size();i++){
			if(in[i]=='0'){
				if(c!=0){
					cout<<S[in[i-1]-'0'][(c-1)%S[in[i-1]-'0'].size()];
					c=0;
				}
			}
			else c++;
		}
		cout<<endl;
	}

}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){

  int m;
  cin>>m;
  REP(i,m){
    string str;
    int num[1000]={0};
    char now;
    int out=0;
    char one[5]={'.',',','!','?',' '};
    cin >> str;
    int hoge = str.size();
    REP(i,hoge){
      num[i] = str[i] - '0';
    };
    REP(c,hoge){
      int k=0;
      if(num[c]==1){
	while(num[c]==1){
	  k++;
	  c++;
	}
	out=(k+4)%5;
	cout << one[out];
      }else if(num[c]==2){
	while(num[c]==2){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'a'+out;
	cout << now;
      }else if(num[c]==3){
	while(num[c]==3){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'd'+out;
	cout << now;
      }else if(num[c]==4){
	while(num[c]==4){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'g'+out;
	cout << now;
      }else if(num[c]==5){
	while(num[c]==5){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'j'+out;
	cout << now;
      }else if(num[c]==6){
	while(num[c]==6){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 'm'+out;
	cout << now ;
      }else if(num[c]==7){
	while(num[c]==7){
	  k++;
	  c++;
	}
	out=(k+3)%4;
	now = 'p'+out;
	cout << now;
      } else if(num[c]==8){
	while(num[c]==8){
	  k++;
	  c++;
	}
	out=(k+2)%3;
	now = 't'+out;
	cout << now;
      }else if(num[c]==9){
	while(num[c]==9){
	  k++;
	  c++;
	}
	out=(k+3)%4;
	now = 'w'+out;
	cout << now;
      }
    }
      cout << endl;
  }}

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

using namespace std;

struct B {
	int button, count;
};

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

int main() {
	int inputn;
	cin >> inputn;
	for(int i=0; i<inputn; i++){
		string input;
		cin >> input;
		queue<B> q;
		for(int j=0; j<input.size(); j++) {
			int count = 0;
			int button = input[j] - '0';
			for (; input[j] != '0'; j++) {
				count++;
			}
			if (count!=0) q.push({button, count});
		}
		
		while (!q.empty()) {
			B b = q.front(); q.pop();
			//cout << b.count << endl;
			cout << blist[b.button][(b.count-1) % blist[b.button].size()];
		}
		cout << endl;

	}
	return 0;
}

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

using namespace std;

map<char, string> keys;

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

    int n; cin >> n;
    while (n--) {
        string s; cin >> s;
        string out;
        char outc = '\0';
        int n = 0;
        for (size_t i = 0; i < s.size(); ++i) {
            char inc = s[i];
            if (inc == '0') {
                if (outc != '\0') {
                    out += outc;
                }
                n = 0;
                outc = '\0';
            } else {
                outc = keys[inc][n++ % keys[inc].size()];
            }
        }
        cout << out << endl;
    }
}

C++: #include <iostream>
using namespace std;
 
int main() {
 
  string key[10] ={
    "00000",
    ".,!? ",
    "abc",
    "def",
    "ghi",
    "jkl",
    "mno",
    "pqrs",
    "tuv",
    "wxyz"
  };
 
 
  int n;
  cin >> n;
  string str;
  for(int j=0;j<n;j++){
    cin >> str;
    int cnt = -1;
    int ima;
    for(int i=0;i<str.size();i++){
      if(cnt == -1 && str[i] == '0') continue;
      if(str[i] == '0'){
    cout <<key[ima][cnt%key[ima].size()];
    cnt = -1;
      }
      else{
    ima = str[i]-'0';
    cnt++;
      }   
    }
    cout << endl;
     
  }
 
    return 0;
}