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 <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){
  int n;
  char s[2], str[MAXLEN + 1];

  cin >> n;
  fgets(s, 2, stdin);

  for (int i = 0; i < n; i++) {
    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;

  if(s[strlen(s) - 1] != '0'){
    answer[0] = 'a';
    return answer;
  }

  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<bits/stdc++.h>
using namespace std;

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

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;++i){
        string s;
        cin >> s;
        int idx = 0, cnt = -1, chr = 0;
        string t = "";
        while(idx < s.size()){
            if(s[idx] == '0'){
                if(chr != 0)t.push_back(table[chr][cnt%table[chr].size()]);
                cnt = -1;
                chr = 0;
                idx++;
            }else{
                chr = s[idx] - '0';
                while(s[idx] == chr + '0' && idx < s.size()){
                    idx++;
                    cnt++;
                }
            }
        }
        cout << t << endl;
    }

    return 0;
}

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

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const double EPS = 1e-10;


int main() {
	int n;
	vs button(10, "");
	vi buttonnum(10, 0);

	button[0] = "";
	button[1] = ".,!? ";
	button[2] = "abc";
	button[3] = "def";
	button[4] = "ghi";
	button[5] = "jkl";
	button[6] = "mno";
	button[7] = "pqrs";
	button[8] = "tuv";
	button[9] = "wxyz";

	while(cin >> n, n) {

		REP(k, n) {
			string input;
			cin >> input;
			string output = "";

			REP(i, input.size()) {
				switch(input[i]) {
				case '0':
					FOR(j, 1, 10) {
						if(buttonnum[j]) {
							output += button[j][(buttonnum[j]-1)%button[j].size()];
							buttonnum[j] = 0;
						}
					}
					break;
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':			
				case '6':			
				case '7':			
				case '8':			
				case '9':			
					++buttonnum[input[i]-'0'];
					break;
				}
			}

			cout << output << endl;
	
		}	
	}
}

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

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

int main() {
	string s1 = ".,!? ", s2 = "abc", s3 = "def", s4 = "ghi",
		s5 = "jkl", s6 = "mno", s7 = "pqrs", s8 = "tuv", s9 = "wxyz";
	int n;
	cin >> n; 
	rep(i, n) {
		string str;
		cin >> str;
		int j = 0;
		int p = -114;
		while (j < str.size()) {
			int cnt = 0;
			while (true) {
				if (str[j] - '0' == 0)break;
				j++;
				cnt++;
			}
			if (j == 0) {
				j++;
				continue;
			}
			switch (str[j - 1] - '0') {
			case 1: cout << s1[(cnt - 1) % s1.size()];
				break;
			case 2: cout << s2[(cnt - 1) % s2.size()];
				break;
			case 3: cout << s3[(cnt - 1) % s3.size()];
				break;
			case 4: cout << s4[(cnt - 1) % s4.size()];
				break;
			case 5: cout << s5[(cnt - 1) % s5.size()];
				break;
			case 6: cout << s6[(cnt - 1) % s6.size()];
				break;
			case 7: cout << s7[(cnt - 1) % s7.size()];
				break;
			case 8: cout << s8[(cnt - 1) % s8.size()];
				break;
			case 9: cout << s9[(cnt - 1) % s9.size()];
				break;
			default:
				break;
			}
			j++;
		}
		cout << endl;
	}
}