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<math.h>
#include <string>
#include <stack>
#include<stdio.h>
#include <queue> 
#include <functional>
#define rep(i,n) for (int i=0; i < (int)(n); i++)

using namespace std;

int main(){
	
	stack<int> st; // スタックを宣言＋初期化
	
	int a,b,c,d,e,num;
	int i,j,k;
	int arr[100];
	int arr2[100][100];
	char x,y,z;
	char crr[100];
	char crr2[100][100];
	string str2;
	string str;
	stack<int> istk; // 整数値を格納するスタックを宣言
    stack<string> sstk; // 文字列を格納するスタックを宣言	
	queue<int> ique; // 整数値を格納するキューを宣言
    queue<string> sque; // 文字列を格納するキューを宣言

	
	
	cin >> num;
	
	rep(i , num){
		
		
		cin >> str;
		

		
		j = 0;
		
		
		while(1){
			
			x = NULL;
			
			if(str[j] == NULL) break;
		
			switch(str[j]){
				
				case '0':
				
				j=j+1;
					break;
					
					
	
				case '1':
				
				
				x = '.';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == '.' ) x = ',';
					else if(x == ',' ) x = '!';
					else if(x == '!' ) x = '?';
					else if(x == '?' ) x = ' ';
					else x = '.';
					j = j+1;
				}
				j = j+1;
					break;
					
				case '2':
				
				
				x = 'a';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'a' ) x = 'b';
					else if(x == 'b' ) x = 'c';
					else x = 'a';
					j = j+1;
				}
				j = j+1;
					break;
				case '3':
				
				
				x = 'd';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'd' ) x = 'e';
					else if(x == 'e' ) x = 'f';
					else x = 'd';
					j = j+1;
				}
				j = j+1;
					break;
				case '4':
				
				
				x = 'g';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'g' ) x = 'h';
					else if(x == 'h' ) x = 'i';
					else x = 'g';
					j = j+1;
				}
				j = j+1;
					break;
				case '5':
				
				
				x = 'j';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'j' ) x = 'k';
					else if(x == 'k' ) x = 'l';
					else x = 'j';
					j = j+1;
				}
				j = j+1;
					break;
				case '6':
				
				
				x = 'm';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'm' ) x = 'n';
					else if(x == 'n' ) x = 'o';
					else x = 'm';
					j = j+1;
				}
				j = j+1;
					break;
				case '7':
				
				
				x = 'p';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'p' ) x = 'q';
					else if(x == 'q' ) x = 'r';
					else if(x == 'r' ) x = 's';
					else x = 'p';
					j = j+1;
				}
				j = j+1;
					break;
				case '8':
				
				
				x = 't';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 't' ) x = 'u';
					else if(x == 'u' ) x = 'v';
					else x = 't';
					j = j+1;
				}
				j = j+1;
					break;
				case '9':
				
				
				x = 'w';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'w' ) x = 'x';
					else if(x == 'x' ) x = 'y';
					else if(x == 'y' ) x = 'z';
					else x = 'w';
					j = j+1;
				}
				j = j+1;
					break;

			}
			
//			str2[k] = x;
//			k = k+1;
			if(x == NULL ) continue; 
			cout << x;		

				
				
		}
		
		cout << endl;
		
		
		
	}
		
	return 0;
		
}

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++)%3];
	break;
      case '8':
	buf=keymap[7][(c++)%4];
	break;
      case '9':
	buf=keymap[8][(c++)%3];
	break;
      }
    }
    buf='\0';
    cout<<endl;
  }
}

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

int data[10][6]={
  {5,'.',',','!','?',' '},
  {3,'a','b','c',0,0},
  {3,'d','e','f',0,0},
  {3,'g','h','i',0,0},
  {3,'j','k','l',0,0},
  {3,'m','n','o',0,0},
  {4,'p','q','r','s',0},
  {3,'t','u','v',0,0},
  {4,'w','x','y','z',0}
};

int main(){
  int n;
  cin>>n;
  string s;
  for(int i=0;i<n;i++){
    cin>>s;
    for(int j=0;j<s.length();j++){
      if(s[j]=='0')continue;
    int tmp=j;
    while(s[j]!='0')j++;

    int button=s[j-1]-'0'-1;
    int cnt=(j-tmp-1)%data[button][0] + 1;

    cout << (char)data[button][cnt];
    }
    cout << endl;
  }
  return 0;
}

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

int main()
{
	int cycle[10] = { 1, 5, 3, 3, 3, 3, 3, 4, 3, 4 };
	char c[10][5] =
	{
		{ '0' },
		{ '.', ',', '!', '?', ' ' },
		{ '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 n;
	cin >> n;
	while (n--)
	{
		string s;
		cin >> s;

		int count = 0;
		char output = '0';

		for (char i : s)
		{
			if (i == '0' && output != '0')
			{
				cout << output;
				output = '0';
				count = 0;
			}
			output = c[i - '0'][count];
			count++;
			if (count >= cycle[i - '0']) count = 0;
		}
		cout << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>

//??????????????????????????????????????????
char key[10][6] = {
  {}, //0
  {5, '.', ',', '!', '?', ' '},
  {3, 'a', 'b', 'c'},
  {3, 'd', 'e', 'f'},
  {3, 'g', 'h', 'i'},
  {3, 'j', 'k', 'l'},
  {3, 'm', 'n', 'o'},
  {4, 'p', 'q', 'r', 's'},
  {3, 't', 'u', 'v'},
  {4, 'w', 'x', 'y', 'z'}
};
		 

int main(){

  int N;

  std::cin >> N;

  //??\????????\???????????°??????????????????????????¨???????????¨???????????????
  while(N){
    int row = 0;
    int count = -1;
  
    std::string str;
    std::cin >> str;

    for(int i = 0; i < (int)str.size(); i++){
      int num = str[i] - '0'; //???'??°???' - '0'??? ??§????????¨???????????°?????????int ?????????(ex: '1'-'0' = 1)

      if(num != 0){
	row = num;
	count++;
      }else{

	if(row != 0) //?????????0?????´???????°?????????????
	  std::cout << key[row][ (count % key[row][0]) + 1 ]; 
	
	row = 0;
	count = -1;
	/*??????????????§???????????????count???0????????????????????????key??????????????????cout%key[row][0]????????????????????¨
	  5550???????????????????????\?????¨???????????????0????????£?????????????????¬??????3????????£????????????????????¨????????????????????????*/
      }

    }

    std::cout << std::endl;

    N--;
    
  }
  return 0;
}