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 <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

// 文字列 split / デリミタに含まれるいずれかの文字で分割
vector<string> split( const string &str, const string &delim = " " )
{
	int start = 0, pos;
	vector<string> result;

	while ( ( pos = str.find_first_of( delim, start ) ) != string::npos )
	{
		result.push_back( str.substr( start, pos - start ) );
		start = pos + 1;
	}

	return result;
}

const VS BUTTONS = {
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz"
};

string solve( string line )
{
	VS chars( split( line, "0" ) );
	string res;

	REP( i, 0, chars.size() )
	{
		if ( !chars[i].size() )
		{
			continue;
		}

		const int pushed_button = chars[i][0] - '0';
		const int pushed_number = chars[i].size() - 1;
		res += BUTTONS[ pushed_button ][ pushed_number % BUTTONS[ pushed_button ].size() ];
	}

	return res;
}

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

	int n;
	cin >> n;
	REP( i, 0, n )
	{
		string line;
		cin >> line;
		cout << solve( line ) << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    char table[9][5]={ {'.',',','!','?',' '},{'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 youso[10] = {0,5,3,3,3,3,3,4,3,4},n;
    cin >> n;
    while(n--){
        int count=0,num,space,s;
        string str;
        cin >> str;
        for(int i=0;i<str.size();i++){
            num = int(str[i]-'0');
            if(num==0){
                if(count>0){
                     s = count%youso[space];
                     if(s==0)   s = youso[space];
                     cout << table[space-1][s-1];
                     count = 0;
                }
            }
            else{
                space=num;
                count++;
            }
        }
        cout << endl;
    }
}

C++: #include<bits/stdc++.h>
char change1[5]={' ','.',',','!','?'};
char change2[3]={'c','a','b'};
char change3[3]={'f','d','e'};
char change4[3]={'i','g','h'};
char change5[3]={'l','j','k'};
char change6[3]={'o','m','n'};
char change7[4]={'s','p','q','r'};
char change8[3]={'v','t','u'};
char change9[4]={'z','w','x','y'};
int cnt;
char change(char c){
    if(c=='1'){
        return change1[cnt%5];
    }
    else if(c=='2'){
        return change2[cnt%3];
    }
    else if(c=='3'){
        return change3[cnt%3];
    }
    else if(c=='4'){
        return change4[cnt%3];
    }
    else if(c=='5'){
        return change5[cnt%3];
    }
    else if(c=='6'){
        return change6[cnt%3];
    }
    else if(c=='7'){
        return change7[cnt%4];
    }
    else if(c=='8'){
        return change8[cnt%3];
    }
    else if(c=='9'){
        return change9[cnt%4];
    }
}
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        vector<char> ans;
        cnt=0;
        char tmp;
        string s;
        cin>>s;
        for(int j=0;j<s.size();j++){
            if(s[j]=='0'){
                if(cnt!=0){
                    ans.push_back(change(tmp));
                    cnt=0;
                }
                else {continue;}
            }
            else{
                tmp=s[j];
                cnt++;
            }
        }
        for(int j=0;j<ans.size();j++){
            cout<<ans.at(j);
        }
        cout<<endl;
        
    }
    return 0;
}

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

int n;
string s;
vector< vector<char> > moji(10, vector<char>(0));

string solve() {
    string ans = "";
    char c;
    int count = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == '0') {
            if (count==0) continue;
            int num = c - '0';
            // cout << moji[num].size() << endl;
            ans += moji[num][(count-1) % moji[num].size()];
            count = 0;
        }
        else {
            c = s[i];
            count++;
        }
        
    }
    return ans;
}

int main() {
    cin >> n;
    moji[1] = {'.', ',', '!', '?', ' '};
    moji[2] = {'a', 'b', 'c'};
    moji[3] = {'d', 'e', 'f'};
    moji[4] = {'g', 'h', 'i'};
    moji[5] = {'j', 'k', 'l'};
    moji[6] = {'m', 'n', 'o'};
    moji[7] = {'p', 'q', 'r', 's'};
    moji[8] = {'t', 'u', 'v'};
    moji[9] = {'w', 'x', 'y', 'z'};

    // moji.push_back({'.', ',', '!', '?', ' '});
    // moji.push_back({'a', 'b', 'c'});
    // moji.push_back({'d', 'e', 'f'});
    // moji.push_back({'g', 'h', 'i'});
    // moji.push_back({'j', 'k', 'l'});
    // moji.push_back({'m', 'n', 'o'});
    // moji.push_back({'p', 'q', 'r', 's'});
    // moji.push_back({'t', 'u', 'v'});
    // moji.push_back({'w', 'x', 'y', 'z'});


    for(int i = 0; i < n; i++) {
        cin >> s;
        cout << solve() << endl;
    }
}