Go: /*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2006&lang=jp
Keitai Message
*/

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// 標準入力を取得するScannerのインスタンスを作成
var scanner = bufio.NewScanner(os.Stdin)

// 標準入力で各行を読み込みstringとして返す
func readLine() string {
	if scanner.Scan() {
		return scanner.Text()
	}
	return ""
}

func main() {
	// 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: 確定ボタン

	// 改行から空白区切りに変更
	scanner.Split(bufio.ScanWords)
	line, _ := strconv.Atoi(readLine()) // 5行標準入力が続く

	table := []string{
		"",      // 0 index調整ためダミーデータ
		".,!? ", // 1
		"abc",   // 2
		"def",   // 3
		"ghi",   // 4
		"jkl",   // 5
		"mno",   // 6
		"pqrs",  // 7
		"tuv",   // 8
		"wxyz"}  // 9

	// 5行分の標準入力を格納するsliceを作成する
	messages := make([]string, 0, line)

	// sliceに標準入力の内容を格納する
	for i := 0; i < line; i++ {
		messages = append(messages, readLine()) // messages=[20 220 222220 44033055505550666011011111090666077705550301110 000555555550000330000444000080000200004440000]
	}

	// 各行毎に解析する
	for _, message := range messages { // message=000555555550000330000444000080000200004440000
		// 0で分割する
		messageSlice := strings.Split(message, "0") // messageSlice=[   55555555    33    444    8    2    444    ]
		for _, word := range messageSlice {
			if word == "" {
				// NOP.
				// 0をセパレーターにしているので空文字がsliceに格納されてい箇所がある
				// 何もしない
			} else { // word=55555555
				// 一文字取り出しコード値をASCII文字に変換する
				ascii := string((word[0])) // word[0]=5

				// ASCII文字からintへ変換する(tableのindexになる)
				number, _ := strconv.Atoi(ascii)

				// 入力回数をカウントする
				count := len(word) // 5

				// 同じ数字を続けて入力すると変化する文字はループすることを考慮する
				for count > len(table[number]) { // 5 > 3
					count -= len(table[number]) // 2
				}

				// キー配列
				keys := table[number]                   //jkl
				fmt.Printf("%s", string(keys[count-1])) //k
			}
		}
		fmt.Println() // 改行
	}
}

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

using namespace std;

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

main(){
  string in;
  int n;
  cin>>n;
  while(n--){
    cin>>in;
    string out;
    int zen='0';
    int c=0;
    for(int i=0;i<in.size();i++){
      if(in[i]=='0' && zen!='0'){
	zen-='1';
	int s=hyo[zen].size();
	--c;
	c%=s;
	out+=hyo[zen][c];
	c=0;
	zen=in[i];
      }else if(in[i]=='0' && zen=='0'){
	continue;
      }else if(zen=='0' && in[i]!=0){
	c=1;
	zen=in[i];
      }else if(in[i]==zen){
	++c;
      }
    }
    cout<<out<<endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { 1, -1, 0, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, 0, 1, -1 , 1,  1, -1, -1 };

int n;
string str;
VS input(9);

string now = "(";
PII many_push;

int gcd( int m, int n ) {
	if ( n == 0 ) return m;
	return gcd( n, m % n );
}

int main() {
	input[ 0 ] = ".,!? ";
	input[ 1 ] = "abc";
	input[ 2 ] = "def";
	input[ 3 ] = "ghi";
	input[ 4 ] = "jkl";
	input[ 5 ] = "mno";
	input[ 6 ] = "pqrs";
	input[ 7 ] = "tuv";
	input[ 8 ] = "wxyz";
	scanf( "%d", &n );
	for ( int i = 0; i < n; i++ ) {
		cin >> str;
		many_push = PII( 10, 10 );
		for ( int j = 0; j < str.size(); j++ ) {	
			if ( str[ j ] == '0' ) {
				if ( now[ 0 ] != '(' ) {
					cout << now;
					now[ 0 ] = '(';
				}
				continue;
			}
			if ( many_push.first != str[ j ] - '1' ) {
				many_push = PII( str[ j ] - '1', 0 );
				now[ 0 ] = input[ many_push.first ][ many_push.second ];
				continue;
			}
			many_push.second++;
			many_push.second %= input[ many_push.first ].size();
			now[ 0 ] = input[ many_push.first ][ many_push.second ];
		}
		printf( "\n" );
	}
	return 0;
}

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

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

	int m;
	cin >> m;
	for(int i=0;i<m;i++){
		string str;
		cin >> str;
		vector<char> res;
		int b=-1,n=-1;
		for(int i=0,a;i<str.length();i++,n++,b=a){
			a=(char)str[i]-'0';
			if(b!=-1&&b!=a){
				if(b!=0)
					res.push_back(key[b][n%key[b].length()]);
				n=-1;
			}
		}
		if(b!=0)
			res.push_back(key[b][n%key[b].length()]);


		string s(res.begin(),res.end());
		cout << s << endl;
	}

	return 0;
}

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

using namespace std;

string replaceAll(string &replacedStr, string from, string to){
    unsigned int pos = replacedStr.find(from);
    int toLen = to.length();

    if(from.empty()){
        return replacedStr;
    }

    while((replacedStr.find(from,pos)) != string::npos){
        pos = replacedStr.find(from,pos);
        replacedStr.replace(pos,from.length(),to);
        pos += toLen;
    }
    return replacedStr;
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string a;
        cin >> a;
        for(int k=0;k<10;k++){
            replaceAll(a,"111111","1");
            replaceAll(a,"2222","2");
            replaceAll(a,"3333","3");
            replaceAll(a,"4444","4");
            replaceAll(a,"5555","5");
            replaceAll(a,"6666","6");
            replaceAll(a,"77777","7");
            replaceAll(a,"8888","8");
            replaceAll(a,"99999","9");
        }
        replaceAll(a,"111110"," ");
        replaceAll(a,"11110","?");
        replaceAll(a,"1110","!");
        replaceAll(a,"110",",");
        replaceAll(a,"10",".");
        replaceAll(a,"2220","c");
        replaceAll(a,"220","b");
        replaceAll(a,"20","a");
        replaceAll(a,"3330","f");
        replaceAll(a,"330","e");
        replaceAll(a,"30","d");
        replaceAll(a,"4440","i");
        replaceAll(a,"440","h");
        replaceAll(a,"40","g");
        replaceAll(a,"5550","l");
        replaceAll(a,"550","k");
        replaceAll(a,"50","j");
        replaceAll(a,"6660","o");
        replaceAll(a,"660","n");
        replaceAll(a,"60","m");
        replaceAll(a,"77770","s");
        replaceAll(a,"7770","r");
        replaceAll(a,"770","q");
        replaceAll(a,"70","p");
        replaceAll(a,"8880","v");
        replaceAll(a,"880","u");
        replaceAll(a,"80","t");
        replaceAll(a,"99990","z");
        replaceAll(a,"9990","y");
        replaceAll(a,"990","x");
        replaceAll(a,"90","w");
        replaceAll(a,"0","");
        cout << a << endl;
    }
}