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 std::cin;
using std::cout;
using std::endl;
using std::string;

int main(){
  string kigo = ".,!? ";
  string a = "abc";
  string d = "def";
  string g = "ghi";
  string j = "jkl";
  string m = "mno";
  string p = "pqrs";
  string t = "tuv";
  string w = "wxyz";
  string syu;
  int keta,n,count;
  int flag1 = 0;
  int flag2 = 0;
  cin >> n;
  string nn;
  for(int i = 0; i < n;i++){
    cin >> nn;
    syu = syu.empty();
    for(int i = 0; i < nn.length();i++){
      if(nn[i] == '1'){
        flag1 = 1;
        flag2 += 1;
      }else if(nn[i] == '2'){
        flag1 = 2;
        flag2 += 1;
      }else if(nn[i] == '3'){
        flag1 = 3;
        flag2 += 1;
      }else if(nn[i] == '4' ){
        flag1 = 4;
        flag2 += 1;
      }else if(nn[i] == '5'){
        flag1 = 5;
        flag2 += 1;
      }else if(nn[i]== '6'){
        flag1 = 6;
        flag2 += 1;
      }else if(nn[i] == '7'){
        flag1 = 7;
        flag2 += 1;
      }else if(nn[i] == '8'){
        flag1 = 8;
        flag2 += 1;
      }else if(nn[i] == '9'){
        flag1 = 9;
        flag2 += 1;
      }else if(nn[i] == '0'){
        if(flag1 == 0){
        }else{
          flag2 -= 1;
          if(flag1 == 1){
            syu += kigo[(flag2)%5];
            flag1 = 0;
          }else if(flag1 == 2){
            syu += a[flag2%3];
            flag1 = 0;
          }else if(flag1 == 3){
            syu += d[flag2%3];
            flag1 = 0;
          }else if(flag1 == 4){
            syu += g[flag2%3];
            flag1 = 0;
          }else if(flag1 == 5){
            syu += j[flag2%3];
            flag1 = 0;
          }else if(flag1 == 6){
            syu += m[flag2%3];
            flag1 = 0;
          }else if(flag1 == 7){
            syu += p[flag2%4];
            flag1 = 0;
          }else if(flag1 == 8){
            syu += t[flag2%3];
            flag1 = 0;
          }else if(flag1 == 9){
            syu += w[flag2%4];
            flag1 = 0;
          }
          flag2 = 0;
        }
      }
    }
      cout << syu << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

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

int main(void){
	int n;
	cin >> n;
	rep(k,n){
		string L;
		cin >> L;
		int type = 0;
		int count = 0;
		char put = '@';
		for(int i = 0; i < L.size(); i++){
			if(L[i] == '0'){
				if(put == '@')continue;
				cout << put;
				put = '@';
				type = 0;
				count = 0;
				continue;
			}
			type = L[i]-'0';
			count++;
			put = s[type-1][(count-1)%s[type-1].size()];
		}
		cout << endl;
	}
	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

C++: #include <string>
#include <algorithm>
#include <iostream>
using namespace std;
int main(){

    int n;
    cin>>n;
    while(n--){
    string chs[10];
    chs[1]=".,!? ";
    chs[2]="abc";
    chs[3]="def";
    chs[4]="ghi";
    chs[5]="jkl";
    chs[6]="mno";
    chs[7]="pqrs";
    chs[8]="tuv";
    chs[9]="wxyz";

    string res;
    string s;
    cin>>s;
    int idx=0;
    int cnt=0;
    for(int i = 0; i < s.size(); i++){
        int num=s[i]-'0';
        if(num==0){
            if(idx!=0){
                res+=chs[idx][cnt];
                idx=0;
                cnt=-1;
            }
        }
        else{
            if(idx==num)
                cnt=(cnt+1)%(chs[idx].size());
            else{
                if(idx!=0)
                    res+=chs[idx][cnt];
                idx=num;
                cnt=0;
            }
        }
    }
    if(idx!=0)
        res+=chs[idx][cnt];
    cout<<res<<endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

char s[9][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'}};

map<char, int> mp;
int N;

int main()
{
    cin >> N;
    for (int i = 1; i <= 9; i++)
    {
        char c = i + '0';
        if (i == 1)
            mp[c] = 5;
        else if (i == 9 || i == 7)
            mp[c] = 4;
        else
            mp[c] = 3;
    }
    for (int i = 0; i < N; i++)
    {
        string t;
        cin >> t;
        int cnt = 0, n = t.size();
        char now = t[0];
        for (int j = 1; j < n; j++)
        {
            if (t[j] == now)
                cnt++;
            else
            {
                if (now != '0')
                {
                    cnt %= mp[now];
                    cout << s[now - '1'][cnt];
                }
                now = t[j], cnt = 0;
            }
        }
        cout << endl;
    }
}

C++: #include<iostream>
using namespace std;
 
int main(void){
 
    int c, a, n, Q;
 
    cin >> Q;
    for(int i=0;i<Q;i++){
        int sum = 0;
        cin >> c >> a >> n;
        while(c >= 1 && a >=1 && n >= 1){
			sum = sum + 1;
			c = c - 1;
			a = a - 1;
			n = n - 1;
		}
        while(c >= 2 && a >= 1){
			sum = sum + 1;
			c = c - 2;
			a = a - 1;
		}
        while(c >= 3){
			sum = sum + 1;
			c = c - 3;
		}
        cout << sum << endl;
    }
 
    return 0;
}