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 <bits/stdc++.h>
using namespace std;
int main(){
  vector<vector<char>> ch = {{}, {'.', ',', '!', '?', ' '}, {'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 T;
  cin >> T;
  for (int i = 0; i < T; i++){
    string S;
    cin >> S;
    int N = S.size();
    int cnt = 0;
    int c = 0;
    for (int j = 0; j < N; j++){
      if (S[j] == '0'){
        if (cnt != 0){
          cout << ch[c][(cnt - 1) % ch[c].size()];
          cnt = 0;
        }
      } else {
        cnt++;
        c = S[j] - '0';
      }
    }
    cout << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  char moji[1024];
  char m1[5]={'.',',','!','?',' '};
  char m2[3]={'a','b','c'};
  char m3[3]={'d','e','f'};
  char m4[3]={'g','h','i'};
  char m5[3]={'j','k','l'};
  char m6[3]={'m','n','o'};
  char m7[4]={'p','q','r','s'};
  char m8[3]={'t','u','v'};
  char m9[4]={'w','x','y','z'};
  
  cin >> n;

  for(int i=0;i < n;i++){
    char write;
    int cnt=0;
    int flag=0;
    
    scanf("%s",moji);
    
    for(int j=0;moji[j] != '\0';j++){
      
      if(moji[j] == '1'){
	if(cnt == 5) cnt=0;
	write = m1[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '2'){
	if(cnt == 3) cnt=0;
	write = m2[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '3'){
	if(cnt == 3) cnt=0;
	write = m3[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '4'){
	if(cnt == 3) cnt=0;
	write = m4[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '5'){
	if(cnt == 3) cnt=0;
	write = m5[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '6'){
	if(cnt == 3) cnt=0;
	write = m6[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '7'){
	if(cnt == 4) cnt=0;
	write = m7[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '8'){
	if(cnt == 3) cnt=0;
	write = m8[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '9'){
	if(cnt == 4) cnt=0;
	write = m9[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '0' && flag ==1){
	cout << write;
	flag=0;
	cnt=0;
      }
    }
    cout << endl;
  }
  return 0;
}

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

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

int main()
{
  int T;
  cin >> T;
  for (int t = 0; t < T; ++t) {
    string s;
    cin >> s;

    int index = 0, cnt = 0;
    for (unsigned int i = 0; i < s.size(); ++i) {
      if (index == 0) {
	index = s[i] - '0';
	cnt = 0;
      } else {
	if (s[i] == '0') {
	  cout << tbl[index][cnt%tbl[index].size()];
	  index = 0;
	} else {
	  ++cnt;
	}
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;


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

int mod[10]={1,5,3,3,3,3,3,4,3,4};


int main(){
    
    int N;
    cin>>N;
    
    REP(i,N){
        string S;
        cin>>S;
        
        int cnt=0;
        string ans;
        
        REP(i,S.size()){
            if(S[i]!='0')cnt++;
            else{
                ans=ans+table[S[i-1]-'0'][(cnt-1)%mod[S[i-1]-'0']];
                cnt=0;
            }
        }
        
        cout<<ans<<endl;
        
    }
    
    return 0;
}

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;
    printf("i = %d\n", i);
    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);
    strcpy(message, "");
    strcpy(rechar, "");
  }

  return 0;
}