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(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string input;
		int count=1;
		
		cin>>input;
		char first=input[0];
		for(int j=1;j<input.size();j++){
			if(first==input[j])count++;
			if(input[j]=='0'){
				if(input[j+1]=='0')continue;
				switch(first){
					case '1':
						switch(count%5){
							case 1:cout<<".";break;
							case 2:cout<<",";break;
							case 3:cout<<"!";break;
							case 4:cout<<"?";break;
							case 0:cout<<" ";break;
						}break;
					case '2':
						switch(count%3){
							case 1:cout<<"a";break;
							case 2:cout<<"b";break;
							case 0:cout<<"c";break;
						}break;
					case '3':
						switch(count%3){
							case 1:cout<<"d";break;
							case 2:cout<<"e";break;
							case 0:cout<<"f";break;
						}break;
					case '4':
						switch(count%3){
							case 1:cout<<"g";break;
							case 2:cout<<"h";break;
							case 0:cout<<"i";break;
						}break;
					case '5':
						switch(count%3){
							case 1:cout<<"j";break;
							case 2:cout<<"k";break;
							case 0:cout<<"l";break;
						}break;
					case '6':
						switch(count%3){
							case 1:cout<<"m";break;
							case 2:cout<<"n";break;
							case 0:cout<<"o";break;
						}break;
					case '7':
						switch(count%4){
							case 1:cout<<"p";break;
							case 2:cout<<"q";break;
							case 3:cout<<"r";break;
							case 0:cout<<"s";break;
						}break;
					case '8':
						switch(count%3){
							case 1:cout<<"t";break;
							case 2:cout<<"u";break;
							case 0:cout<<"v";break;
						}break;
					case '9':
						switch(count%4){
							case 1:cout<<"w";break;
							case 2:cout<<"x";break;
							case 3:cout<<"y";break;
							case 0:cout<<"z";break;
						}break;
				}
				first=input[j+1];
				count=0;
			}	
		}
		
			cout<<endl;	
	}
}

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

int main(){

  char a[10][10]={".,!? ", "abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"}, c;
  string s;
  int n, cnt, b[10]={5, 3, 3, 3, 3, 3, 4, 3, 4};

  cin>>n;
  for(int i=0;i<n;i++){
    cnt=0;
    cin>>s;
    for(int j=0;j<s.size();j++){
      if(s[j]=='0'){
	cout<<(char)a[c-'0'-1][--cnt%b[c-'0'-1]];
	cnt=0;
      }else{
	c=s[j];
	cnt++;
      }
    }
    cout<<endl;
  }
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back

char str[12][5] ={"",".,!?","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
int mod[12] = {0,4,3,3,3,3,3,4,3,4};

int main(void){
  int n;
  cin >> n;
  rep(test,n){
    string s;
    cin >> s;
    int num = -1;
    int cnt = -1;
    rep(i,s.sz){
      if(s[i] == '0'){
        if(num != -1){
          printf("%c", str[num][cnt%mod[num]]);
          num = -1;
          cnt = -1;
        }
      }else{
        num = s[i] - '0';
        cnt++;
      }
    }
    puts("");
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<ll,ll,ll,ll> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	string out[]={
		{".,!? "},
		{"abc"},
		{"def"},
		{"ghi"},
		{"jkl"},
		{"mno"},
		{"pqrs"},
		{"tuv"},
		{"wxyz"}
	};
	int n;
	cin>>n;
	while(n--){
		string s;
		cin>>s;
		int now=-1,co=0;
		s+="0";
		rep(i,s.size()){
			if(s[i]=='0'){
				co--;
				if(now+1)cout<<out[now][co%out[now].size()];
				now=-1;
				co=0;
			}else{
				now=s[i]-'1';
				co++;
			}
		}
		cout<<endl;
	}
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  string s[10];
  s[1] = ".,!? ";
  s[2] = "abc";
  s[3] = "def";
  s[4] = "ghi";
  s[5] = "jkl";
  s[6] = "mno";
  s[7] = "pqrs";
  s[8] = "tuv";
  s[9] = "wxyz";
  int T; cin >>T;
  REP(t, T){
    string str; cin >>str;
    int num = -1, cnt = -1;
    REP(i, str.length()){
      int n = str[i] - '0';
      if(n == 0){
        if(cnt != -1){
          cout <<s[num][cnt % (int)s[num].length()];
          cnt = -1;
          num = -1;
        }
      } else{
        if(num == -1) num = n;
        ++cnt;
      }
    }
    cout <<endl;
  }
  return 0;
}