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 <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
#define d_arr(arr, h, w) rep(i,(h) ){ cout << "["; rep(j,(w) ) { cout << (arr)[i][j] << ", "; } cout << "]" << endl;}

typedef pair<int ,int> P;

/*
1: . , ! ? (スペース)
2: a b c
3: d e f
4: g h i
5: j k l
6: m n o
7: p q r s
8: t u v
9: w x y z
0: 確定ボタン
 */

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


int main()
{
    int n;
    int index;
    int count=0;
    string s;
    int loop;
    cin >> loop;
    rep(i, loop)
    {
        string s;
        cin >> s;
        rep(j, s.size() )
        {
            string st;
            st[0] = s[j];
            n = atoi( &st[0] );
            if( n == 0 && count == 0) { continue; }
            else if( n == 0 ) 
            { 
                cout << a[index - 1][(count - 1) % a[index - 1].size() ];  
                count = 0;
            }
            else
            {
                index = n;
                count++;
            }
        }
        cout << endl;
    }
    //if ( count > 0 ) { cout << a[index - 1][(count - 1) % 9]; count = 0; }
}

C++: #include<iostream>
#include<string>
using namespace std;
#define rep(i,j) for(int i = 0; i < (j); i++)
int main(){
	int n;
	cin >> n;
	string change[] = {"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};	
	while(n--){
		string str;
		cin >> str;
		int len = str.size();
		string ans = "";
		rep(i,len){
			if(str[i] == '0')continue;
			int sub = i;
			while(str[i] == str[++sub]);
			ans += change[str[sub-1]-48][(sub-i-1)%change[str[sub-1]-48].size()];
			i = sub;
		}
		cout << ans << endl;
	}	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;

vector< vector<char> > chars = {
	{ '.', ',', '!', '?', ' ' },
	{ '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' }
};

int main()
{
	int n; cin >> n;
	rep(i, 0, n)
	{
		string s; cin >> s;

		int back = -1;
		int click_num = 0;
		string ans = "";
		rep(j, 0, s.length())
		{
			int num = s[j] - '0';
			if (num == 0)
			{
				if (back < 0) continue;
				ans += chars[back][click_num % chars[back].size()];
				back = -1;
			}
			else
			{
				if (back < 0)
				{
					back = num - 1;
					click_num = -1;
				}

				click_num++;
			}
		}

		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

#define MAXLEN 1024
#define MAXCHAR 76

char judge(char c, int x){
  int i;

  if(c == '1'){
    i = x % 5;

    if(i == 0){
      return ' ';
    } else if(i == 1){
      return '.';
    } else if(i == 2){
      return ',';
    } else if(i == 3){
      return '!';
    } else if(i == 4){
      return '?';
    }
    
  } else if(c == '2'){
    i = x % 3;
    if(i == 1){
      return 'a';
    } else if(i == 2){
      return 'b';
    } else if(i == 0){
      return 'c';
    }
  } else if(c == '3'){
    i = x % 3;
    if(i == 1){
      return 'd';
    } else if(i == 2){
      return 'e';
    } else if(i == 0){
      return 'f';
    }
  } else if(c == '4'){
    i = x % 3;
    if(i == 1){
      return 'g';
    } else if(i == 2){
      return 'h';
    } else if(i == 0){
      return 'i';
    }
  } else if(c == '5'){
    i = x % 3;
    if(i == 1){
      return 'j';
    } else if(i == 2){
      return 'k';
    } else if(i == 0){
      return 'l';
    }
  } else if(c == '6'){
    i = x % 3;
    if(i == 1){
      return 'm';
    } else if(i == 2){
      return 'n';
    } else if(i == 0){
      return 'o';
    }
  } else if(c == '7'){
    i = x % 4;
    if(i == 1){
      return 'p';
    } else if(i == 2){
      return 'q';
    } else if(i == 3){
      return 'r';
    } else if(i == 4){
      return 's';
    }
  } else if(c == '8'){
    i = x % 3;
    if(i == 1){
      return 't';
    } else if(i == 2){
      return 'u';
    } else if(i = 0){
      return 'v';
    }
  } else if(c == '9'){
    i = x % 4;
    if(i == 1){
      return 'w';
    } else if(i == 2){
      return 'x';
    } else if(i == 3){
      return 'y';
    } else if(i == 0){
      return 'z';
    }
  }

}

void ret_char(char *s, int sp, char *r){
  if(*s != '\0'){
    if(*s == '0'){
      if(sp != 0){
	*r = judge(*(s - 1), sp);
	sp = 0;
	s++;
	r++;
	ret_char(s, sp, r); // 再帰
      } else {
	s++;
	ret_char(s, sp, r); // 再帰
      }
    } else {
      s++;
      sp++;
      ret_char(s, sp, r); // 再帰
    }
  }

}

main(){
  int testcase, i, j, count = 0;
  char message[MAXLEN + 1], *rechar = (char *)malloc(sizeof(char) * MAXCHAR);

  cin >> testcase;

  for (i = 0; i < testcase; i++){
    scanf("%s", message);
    message[strlen(message)] = '\0';
    ret_char(message, 0, rechar);
    printf("%s\n", rechar);
    strcpy(message, "");
    strcpy(rechar, "");
  }

  return 0;
}

C++: #include <iostream>
#include <string.h>
using namespace std;
int main(){
  int n,i,j,len,count,which,flag;
  char in[1025];
  char data[10][6]={
    {' ',' ',' ',' ',' '},
    {'.',',','!','?',' '},
    {'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'}
  };
  cin >> n;
  for(i=0;i<n;i++){
    cin >> in;
    len=strlen(in);
    count=-1;
    which=0;
    for(j=0;j<len;j++){
      flag=0;
      if(in[j]=='1') which=1;
      else if(in[j]=='2') which=2;
      else if(in[j]=='3') which=3;
      else if(in[j]=='4') which=4;
      else if(in[j]=='5') which=5;
      else if(in[j]=='6') which=6;
      else if(in[j]=='7') which=7;
      else if(in[j]=='8') which=8;
      else if(in[j]=='9') which=9;
      else{
        if(which==0) continue;
    if(which==1) count%=5;
    else if(which==2||which==3||which==4||which==5||which==6||which==8) count%=3;
    else if(which==7||which==9) count%=4;
    cout << data[which][count];
    flag=1;
        count=-1;
        which=0;
      }
      if(flag==0) count++;
    }
    cout << endl;
  }
  return 0;
}