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>

using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        string msg;
        string output = "";
        int count = 0;
        char buf;

        cin >> msg;

        for (int j = 0; j < (int)msg.size(); j++) {
            char c = msg[j];

            if (c == '0' && j != 0) {
                if (buf == '1') {
                    if (count % 5 == 1)
                        output += ".";
                    else if (count % 5 == 2)
                        output += ",";
                    else if (count % 5 == 3)
                        output += "!";
                    else if (count % 5 == 4)
                        output += "?";
                    else if (count % 5 == 0)
                        output += " ";
                } else if (buf == '2') {
                    if (count % 3 == 1)
                        output += "a";
                    else if (count % 3 == 2)
                        output += "b";
                    else if (count % 3 == 0)
                        output += "c";
                } else if (buf == '3') {
                    if (count % 3 == 1)
                        output += 'd';
                    else if (count % 3 == 2)
                        output += 'e';
                    else if (count % 3 == 0)
                        output += 'f';
                } else if (buf == '4') {
                    if (count % 3 == 1)
                        output += 'g';
                    else if (count % 3 == 2)
                        output += 'h';
                    else if (count % 3 == 0)
                        output += 'i';
                } else if (buf == '5') {
                    if (count % 3 == 1)
                        output += 'j';
                    else if (count % 3 == 2)
                        output += 'k';
                    else if (count % 3 == 0)
                        output += 'l';
                } else if (buf == '6') {
                    if (count % 3 == 1)
                        output += 'm';
                    else if (count % 3 == 2)
                        output += 'n';
                    else if (count % 3 == 0)
                        output += 'o';
                } else if (buf == '7') {
                    if (count % 4 == 1)
                        output += 'p';
                    else if (count % 4 == 2)
                        output += 'q';
                    else if (count % 4 == 3)
                        output += 'r';
                    else if (count % 4 == 0)
                        output += 's';
                } else if (buf == '8') {
                    if (count % 3 == 1)
                        output += 't';
                    else if (count % 3 == 2)
                        output += 'u';
                    else if (count % 3 == 0)
                        output += 'v';
                } else if (buf == '9') {
                    if (count % 4 == 1)
                        output += 'w';
                    else if (count % 4 == 2)
                        output += 'x';
                    else if (count % 4 == 3)
                        output += 'y';
                    else if (count % 4 == 0)
                        output += 'z';
                }
                count = 0;
                buf = '\0';
            } else {
                count++;
                buf = msg[j];
            }
        }
        cout << output << '\n';
    }

    return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
int main() {
	string a;
	string d[10] = { "",".,!? ","abc","def","ghi","jkl","mno",
		"pqrs","tuv","wxyz" };
	int m;
	cin >> m;
	for (int z = 0; z < m; z++) {
		cin >> a;
		string c = "";
		for (int i = 0; i < a.length();) {
			while (a[i] == '0'&&i < a.length())i++;
			if (i == a.length()) break;
			int j = i;
			while (a[j] == a[i] && i < a.length()) {
				i++;
			}
			int sum = i - j - 1;
			sum %= d[(int)a[j] - '0'].length();
			if (i < a.length() && a[i] == '0')c += d[(int)a[j] - '0'][sum];
		}
		if (c != "") cout << c << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
using namespace std;

int N;
string input, keitai[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
stack<char> st;

int main(void){
  cin >> N;
  while(N--){
    cin >> input;
    for(int i = 0; i < input.size(); i++){
      if(input[i] == '0' && !st.empty()){
        int cnt = 0, b = st.top() - '0';
        while(!st.empty()){
          st.pop(); cnt++;
        }
        cout << keitai[b][(cnt - 1) % keitai[b].size()];
      }else if(input[i] != '0'){
        st.push(input[i]);
      }
    }
    cout << endl;
  }
  return 0;
}

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

int main(){
  int n;
  string str;
  char one[] = {'.',',','!','?',' '};
  int xxx[10] = {0,5,3,3,3,3,3,4,3,4};
  int yyy[10] = {0,0,0,3,6,9,12,15,19,22};
  cin >> n;
  while(n--){
    vector<char> msg;
    vector<int> msg_n;
    cin >> str;
    char curr = str[0];
    int num = 1;
    for(int i=1; i<str.size(); i++){
      if(str[i] == curr)
	num++;
      else{
	if(str[i-1] != '0'){
	  msg.push_back(str[i-1]);
	  msg_n.push_back(num);
	}
	num = 1;
	curr = str[i];
      }
    }
    if(curr != '0'){
      msg.push_back(curr);
      msg_n.push_back(num);
    }
    int pos, pres;
    for(int i=0; i<msg.size(); i++){
      if(msg[i] == '1')
	cout << one[(msg_n[i]+4)%5];
      else{
	pos = msg[i] - '0';
	pres = yyy[pos] + ((msg_n[i]+xxx[pos]-1) % xxx[pos]) + 'a';
	char ttt = pres;
	cout << ttt;
      }
    }
    cout << endl;
  }

  return 0;
}