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<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 



*/


int main()
{
	int n;
	cin >> n;
	string ans[10] = { ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv","wxyz"};
	while (n--)
	{
		string a;
		cin >> a;
		int now = -1;
		for (int i = 0; i < a.size(); i++)
		{
			int k = a[i] - 48;
			if (k == 0)
			{
				if (now != -1)
				{
					cout << ans[(int)(a[i-1]-49)][(now) % (int)ans[a[i-1]-49].size()];
					now = -1;
				}
			}
			else
			{
				now++;
			}


		}
		cout << endl;
	}
	return 0;
}

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

vector<vector<char>> sett = {
  {'.', ',', '!', '?', ' '},
  {'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;
  vector<vector<char>> anss;
  for(int i = 0 ; i < N ; i++){
    string inp; cin >> inp;
    vector<char> ans;
    int count = 0;
    char pre = '+';
    for(int j = 0 ; j < sizeof(inp); j++){
      if(inp[j] == '0'){
        if(count == 0) continue;
        const char A = pre;
        int B = atoi(&A);
        ans.push_back(sett[B-1][(count-1)%sett[B-1].size()]);
        count = 0;
      }
      else{
        pre = inp[j];
        count++;
      }
    }
    anss.push_back(ans);
  }
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < sizeof(anss[i]); j++){
      cout << anss[i][j];
    }
    cout << endl;
  }
}

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

#define MAXLEN 1024

char *renovate(char *s);
char judge(char string, int c){

  if(string == '1'){
    if(c % 5 == 1){
      return '.';
    } else if(c % 5 == 2){
      return ',';
    } else if(c % 5 == 3){
      return '!';
    } else if(c % 5 == 4){
      return '?';
    } else if(c % 5 == 0){
      return ' ';
    }

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

}
  
int main(void){
  char str[MAXLEN + 1];

  fgets(str, MAXLEN, stdin);

  if(str[strlen(str) - 1] == '\n'){
    str[strlen(str) - 1] = '\0';
  }

  cout << renovate(str) << endl;

  return 0;
}

char *renovate(char *s){
  char *answer = (char *)malloc(sizeof(s)), number = ' ';
  int i, j = 0, count = 0;

  for(i = 0; *(s + i) != '\0'; i++){
    if(*(s + i) != '0'){
      if(count == 0){
	number = *(s + i);
	count++;
      } else if(count != 0){
	count++;
      } 
    } else if(*(s + i) == '0'){
      if(number != ' '){
	answer[j++] = judge(number, count);
	count = 0;
	number = ' ';
      }
    }
  }

  answer[j] = '\0';

  return answer;
}

C++: #include <algorithm>
#include <iostream>
#include <limits.h>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1

using namespace std;

int main() {
  int n, pre, cur, count;
  string s;
  string org[] = {".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
  vector<string> button(org, end(org));
  cin >> n;
  while (n--) {
    cin >> s;
    pre = 0;
    for (int i = 0; i < s.length(); i++) {
      cur = (int)(s[i]-'0');
      if (pre == 0) {
        if (cur != 0) {
          pre = cur;
        }
      } else {
        if (cur == 0) {
          cout << button[pre-1][count];
          pre = 0;
          count = 0;
        } else {
          count = (count+1)%button[pre-1].length();
        }
      }
    }
    cout << el;
  }
}

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

	}
	if(state == 1) cout << endl;
	return 0;
}