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<stdio.h>
using namespace std;

int main(){

	char data[10][5] = {'E','E','E','E','E',
					'.', ',', '!' ,'?' ,' ',
					'a', 'b', 'c', 'E', 'E',
					'd','e','f','E','E',
					'g','h','i','E','E',
					'j','k','l','E','E',
					'm','n','o','E','E',
					'p','q','r','s','E',
					't','u','v','E','E',
					'w','x','y','z','E'};

	char in;
	int col=-1, row=0;
	int num;
	int state = 0;
	while(scanf("%c",&in) != EOF){

		if(in == '0'){
			if(col == -1) col++;
			if(row >= 2 && row <= 6 || row == 8) num = 3;
			else if(row == 1) num = 5;
			else num = 4;

			if(data[row][col%num] != 'E'){
				cout << data[row][col%num];
				state = 1;
			}
			col = -1;
			row = 0;
		}else{
			col++;
			row=in-48;
		}
		if(in == '\n'){
			if(state == 1) cout << endl;
			state = 0;
			col = -1;
			row = 0;
		}

	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
struct keitai{
    int key=0,val=0;
    vs d={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    void in(int k){
        if(key==k)val++;
        else{
            if(key) cout<<d[key][val%d[key].size()];
            key=k,val=0;
        }
    }
};
int main(void){
    int n;
    cin>>n;
    rep(i,n){
        keitai k;
        string s;
        cin>>s;
        for(auto c:s){
            k.in(c-'0');
        }
        cout<<endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
int exec();

class Line {
  public:
    string line;
    int i, n;
    Line(string _line) {
      line = _line;
      i = 0;
      read();
    }
    int read() {
      stringstream ss;
      ss << line[i];
      ss >> n;
      // n = static_cast<int>(line[i]);
    }
    bool next() {
      ++i;
      if(i == line.size()) return false;
      read();
      return true;
    }
    int get() {
      return n;
    }
};

int main() {
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i) exec();
  return 0;
}

int exec() {
  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 n, count;
  string line;
  cin >> line;
  Line pattern(line);
  while(true) {
    count = 0;
    while(!(n = pattern.get())) if(!pattern.next()) {
      cout << endl;
      return 0;
    }
    while(pattern.next(), pattern.get()) ++count;
    cout << chars[n - 1][count % (chars[n - 1].size())];
  }
  return 0;
}

C++: #include<string>
using namespace std;
string search(int n[]) {
	if (n[0]) {
		if (n[0]%5 == 1) {
			n[0] = 0;
			return ".";
		}
		else if (n[0]%5 == 2) {
			n[0] = 0;
			return ",";
		}
		else if (n[0]%5 == 3) {
			n[0] = 0;
			return "!";
		}
		else if(n[0]%5==4) {
			n[0] = 0;
			return "?";
		}
		else {
			n[0] = 0;
			return " ";
		}
	}
	else if (n[1]) {
		if (n[1] % 3 == 1) {
			n[1] = 0;
			return "a";
		}
		else if (n[1] % 3 == 2) {
			n[1] = 0;
			return "b";
		}
		else {
			n[1] = 0;
			return "c";
		}
	}
	else if (n[2]) {
		if (n[2] % 3 == 1) {
			n[2] = 0;
			return "d";
		}
		else if (n[2] % 3 == 2) {
			n[2] = 0;
			return "e";
		}
		else {
			n[2] = 0;
			return "f";
		}
	}
	else if (n[3]) {
		if (n[3] % 3 == 1) {
			n[3] = 0;
			return "g";
		}
		else if (n[3] % 3 == 2) {
			n[3] = 0;
			return "h";
		}
		else {
			n[3] = 0;
			return "i";
		}
	}
	else if (n[4]) {
		if (n[4] % 3 == 1) {
			n[4] = 0;
			return "j";
		}
		else if (n[4] % 3 == 2) {
			n[4] = 0;
			return "k";
		}
		else {
			n[4] = 0;
			return "l";
		}
	}
	else if (n[5]) {
		if (n[5] % 3 == 1) {
			n[5] = 0;
			return "m";
		}
		else if (n[5] % 3 == 2) {
			n[5] = 0;
			return "n";
		}
		else {
			n[5] = 0;
			return "o";
		}
	}
	else if (n[6]) {
		if (n[6] % 4 == 1) {
			n[6] = 0;
			return "p";
		}
		else if (n[6] % 4 == 2) {
			n[6] = 0;
			return "q";
		}
		else if (n[6] % 4 == 3) {
			n[6] = 0;
			return "r";
		}
		else {
			n[6] = 0;
			return "s";
		}
	}
	else if (n[7]) {
		if (n[7] % 3 == 1) {
			n[7] = 0;
			return "t";
		}
		else if (n[7] % 3 == 2) {
			n[7] = 0;
			return "u";
		}
		else {
			n[7] = 0;
			return "v";
		}
	}
	else if (n[8]) {
		if (n[8] % 4 == 1) {
			n[8] = 0;
			return "w";
		}
		else if (n[8] % 4 == 2) {
			n[8] = 0;
			return "x";
		}
		else if (n[8] % 4 == 3) {
			n[8] = 0;
			return "y";
		}
		else {
			n[8] = 0;
			return "z";
		}
	}
	return "";
}


int main() {
	int i;
	cin >> i;
	string num;
	string s;
	int n[9] = {};
	for (int j = 0; j<i; j++) {
		cin >> num;
		for (int j = 0; j < num.size() ; j++) {
			switch (num[j]) {
			case '1':
				n[0]++;
				break;
			case '2':
				n[1]++;
				break;
			case '3':
				n[2]++;
				break;
			case '4':
				n[3]++;
				break;
			case '5':
				n[4]++;
				break;
			case '6':
				n[5]++;
				break;
			case '7':
				n[6]++;
				break;
			case '8':
				n[7]++;
				break;
			case '9':
				n[8]++;
				break;
			default:
					s += search(n);
			}
		}
		cout << s << endl;
		s = "";
	}
}

C++: #include <iostream>

using namespace std;

int main( void )
{
	const char *key[] = { ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz" };
	const int size[] = { 5, 3, 3, 3, 3, 3, 4, 3, 4 };
	int n;
	cin >> n;
	while(n--) {
		char buff[1025];
		scanf("%s", buff);
		char msg[77]; msg[0] = 0;
		int index = -1, no, pnt = 0;
		for(int i=0; buff[i]; ++i) {
			if('0' == buff[i]) {
				if(index != -1) {
					msg[pnt++] = key[no][index];
					msg[pnt] = 0;
				}
				index = -1;
			}
			else { // 1~9
				no = buff[i]-'1';
				index = (index+1) % size[no];
			}
		}
		cout << msg << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;
int main(){
  char m[9][5]={{'.',',','!','?',' '},
		{'a','b','c','1','1'},
		{'d','e','f','1','1'},
		{'g','h','i','1','1'},
		{'j','k','l','1','1'},
		{'m','n','o','1','1'},
		{'p','q','r','s','1'},
		{'t','u','v','1','1'},
		{'w','x','y','z','1'}};

  int a,count=0,c[100],d;
  char b[100][1025];
  cin>>a;
  for(int i=0;i<a;i++){
    scanf("%s",b[i]);
    c[i]=strlen(b[i]);
    for(int j=0;j<c[i];j++){
      if(b[i][j]!='0')count++;
      else
	if(b[i][j-1]!=0){
	  d=(int)(b[i][j-1])-48;

	  if(d==1)
	    if(count%5!=0)
	      cout<<m[d-1][count%5-1];
	    else cout<<m[d-1][4];

	  else if(d==7 || d==9)
	    if(count%4!=0)
	      cout<<m[d-1][count%4-1];
	    else cout<<m[d-1][3];

	  else
	    if(count%3!=0)
	      cout<<m[d-1][count%3-1];
	    else cout<<m[d-1][2]; 
	  count=0;
	}
    }
    cout<<endl;
  }
  return 0;
}