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<string>
#include<iostream>
using namespace std;

int main(){
  int prev=10,n,c=0;
  string str;
  char s,buf='\0';
  char keymap[9][5]={ {'.',',','!','?',' '},
		      {'a','b','c','\0','\0'},
		      {'d','e','f','\0','\0'},
		      {'g','h','i','\0','\0'},
		      {'j','k','l','\0','\0'},
		      {'m','n','o','\0','\0'},
		      {'p','q','r','s','\0'},
		      {'t','u','v','\0','\0'},
		      {'w','x','y','z','\0'}};
  cin>>n;

  while(n--){
    cin>>str;
    for(int i=0;i<str.length();i++){
      s=str.at(i);
      if(c!=0&&s=='0')cout<<buf,c=0,buf=0;
      switch (s){
      case '1':
	buf=keymap[0][(c++)%5];
	break;
      case '2':
	buf=keymap[1][(c++)%3];
	break;
      case '3':
	buf=keymap[2][(c++)%3];
	break;
      case '4':
	buf=keymap[3][(c++)%3];
	break;
      case '5':
	buf=keymap[4][(c++)%3];
	break;
      case '6':
	buf=keymap[5][(c++)%3];
	break;
      case '7':
	buf=keymap[6][(c++)%4];
	break;
      case '8':
	buf=keymap[7][(c++)%3];
	break;
      case '9':
	buf=keymap[8][(c++)%4];
	break;
      }
    }
    buf=0;
    cout<<endl;
  }
}

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

using namespace std;

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

int main(void){
  int n;
  string s;

  cin >> n;
  for(int i=0; i<n; i++){
    vector<char> v;
    cin >> s;

    int count = 0;
    for(int j=0; j<s.size(); j++){
      if(s[j] == '0'){
        if(j == 0 || s[j-1] == '0')
          continue;

        v.push_back(button[(s[j-1]-'0')-1][(count-1)%button[(s[j-1]-'0')-1].size()]);
        count = 0;
      } else {
        count++;
      }
    }

    for(int j=0; j<v.size(); j++){
      cout << v[j];
    }
    cout << endl;
  }

  return 0;
}

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

char outc(int button, int cnt) {
  static char s[10] = {' ',' ','a','d','g','j','m','p','t','w'};
  static int a[10] = {0,0,3,3,3,3,3,4,3,4};
  if(button == 1) {
    switch(cnt%5) {
    case 1:return '.';
    case 2:return ',';
    case 3:return '!';
    case 4:return '?';
    case 0:return ' ';
    }
  } else {
    return s[button] +  (cnt-1)%a[button];
  }
}

main() {
  int N;
  int button;
  int cnt;
  cin >> N;
  getchar();
  for(int t = 0; t < N; t++) {
    button = 0;
    while(1) {
      char c = getchar();
      if(button == 0 && c != '0') {
	button = int(c-'0');
	cnt = 1;
      } else if(button != 0 && c == '0') {
	cout << outc(button, cnt);
	button = 0;
      } else {
	cnt++;
      }
      if(c == '\n') break;
    }
    cout << endl;
  }
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  string but[10] = {
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz",
  };
  REP(t,N){
	string str; cin >> str;
	int cur = -1, p = -1;
	REP(i,SZ(str)){
	  if(str[i] == '0' && p > 0){
		cout << but[p][cur%SZ(but[p])];
		cur = p = -1;
	  }
	  else{
		p = str[i] - '0';
		++cur;
	  }
	}
	cout << endl;
  }
  return 0;
}

C++: 

#include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
#define USE_MATH_DEFINES
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-9;

typedef pair<xy_t, bool> dat;

namespace std{
	bool operator < (const xy_t &a, const xy_t &b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

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

int main(){
	int n;
	string s;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s;
		int pos = 0;
		int sz = s.size();
		while(pos < sz){
			while(pos < sz && s[pos] == '0') pos++;
			if(pos == sz) break;
			char ch = s[pos];
			int cnt = 0;
			while(pos < sz && s[pos] == ch) cnt++, pos++;
			cout << chs[ch-'1'][(cnt-1)%chs[ch-'1'].size()];
		}
		cout << endl;
	}
	return 0;
}