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>

#define rep(i,n) for(unsigned int i=0; i<n; i++)

void solve(void){

	int m;					//文字列の行数
	std::string sl;		//文字列格納用ストリング型変数

	char c[10][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'},
	};

	std::cin >> m;
	while(m--){

		int t = 0;

		std::cin >> sl;

		rep(i,sl.size()-1){
			if(sl[i] == sl[i+1]){
				t++;
			}else{
				if(sl[i]=='7' || sl[i]=='8'){
					t %= 4;
				}
				else if(sl[i]=='1'){
					t %= 5;
				}else{
					t %= 3;
				}
				if(sl[i] != '0'){
					std::cout << c[sl[i]-'0'][t];
				}
				t = 0;
			}
		}
		std::cout << std::endl;
	}
}

int main(void){

	solve();

	return 0;
}

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;
    }
}