Go: package main

import (
	"bytes"
	"fmt"
)

//Ktai has a keyboard and a state.
type Ktai struct {
	keyboard KeyBoard
	textBuf  *bytes.Buffer
}

// KeyBoard is type of a map.
type KeyBoard map[rune]string

// KEYBOARD that Ktai has
var KEYBOARD = KeyBoard{
	'0': "",
	'1': ".,!? ",
	'2': "abc",
	'3': "def",
	'4': "ghi",
	'5': "jkl",
	'6': "mno",
	'7': "pqrs",
	'8': "tuv",
	'9': "wxyz",
}

func main() {
	var N int
	fmt.Scanf("%d", &N)
	ktai := &Ktai{
		KEYBOARD, &bytes.Buffer{},
	}
	for i := 0; i < N; i++ {
		var numstr string
		fmt.Scanf("%s", &numstr)
		ktai.feed(numstr)
		ktai.print()
	}
}

func (ktai *Ktai) feed(str string) {
	var char *byte
	for _, v := range str {
		if v == '0' {
			if char != nil {
				ktai.textBuf.WriteByte(*char)
				char = nil
			}
			continue
		} else {
			runestring := ktai.keyboard[v]
			idx := ktai.indexOf(char, runestring)
			next := (idx + 1) % len(runestring)
			c := runestring[next]
			char = &c
		}
	}
}

func (ktai *Ktai) indexOf(ch *byte, str string) int {
	if ch == nil {
		return -1
	}
	r := rune(*ch)
	idx := -1
	for i, v := range str {
		if r == v {
			idx = i
			break
		}
	}
	return idx
}

func (ktai *Ktai) print() {
	fmt.Println(ktai.textBuf.String())
	ktai.textBuf.Reset()
}

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

using namespace std;

string keyd[] = {"",".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
bool keysize[] = {false, false, false, false, false, false, false, true, false, true};
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		string input; cin >> input;
		int pos = -1, key = 0;
		string::iterator itr = input.begin();
		while(itr != input.end()){
			if( *itr == '0'){
				if(key == 0){
					itr++;
					continue;
				}
				if(keysize[key]) pos = pos % 4;
				else if(key == 1) pos = pos % 5;
				else pos = pos % 3;
				cout << keyd[key][pos];
				pos = -1;
			}
			else{
				if(pos == -1)key = *itr - '0';
				pos++;
			}
			itr++;
		}
		cout << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  vector<vector<char>> ch = {{}, {'.', ',', '!', '?', ' '}, {'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 T;
  cin >> T;
  for (int i = 0; i < T; i++){
    string S;
    cin >> S;
    int N = S.size();
    int cnt = 0;
    int c = 0;
    for (int j = 0; j < N; j++){
      if (S[j] == '0'){
        if (cnt != 0){
          cout << ch[c][(cnt - 1) % ch[c].size()];
          cnt = 0;
        }
      } else {
        cnt++;
        c = S[j] - '0';
      }
    }
    cout << endl;
  }
}

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

int main(){
  int n;
  char moji[1024];
  char m1[5]={'.',',','!','?',' '};
  char m2[3]={'a','b','c'};
  char m3[3]={'d','e','f'};
  char m4[3]={'g','h','i'};
  char m5[3]={'j','k','l'};
  char m6[3]={'m','n','o'};
  char m7[4]={'p','q','r','s'};
  char m8[3]={'t','u','v'};
  char m9[4]={'w','x','y','z'};
  
  cin >> n;

  for(int i=0;i < n;i++){
    char write;
    int cnt=0;
    int flag=0;
    
    scanf("%s",moji);
    
    for(int j=0;moji[j] != '\0';j++){
      
      if(moji[j] == '1'){
	if(cnt == 5) cnt=0;
	write = m1[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '2'){
	if(cnt == 3) cnt=0;
	write = m2[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '3'){
	if(cnt == 3) cnt=0;
	write = m3[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '4'){
	if(cnt == 3) cnt=0;
	write = m4[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '5'){
	if(cnt == 3) cnt=0;
	write = m5[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '6'){
	if(cnt == 3) cnt=0;
	write = m6[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '7'){
	if(cnt == 4) cnt=0;
	write = m7[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '8'){
	if(cnt == 3) cnt=0;
	write = m8[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '9'){
	if(cnt == 4) cnt=0;
	write = m9[cnt];
	flag=1;
	cnt++;
      }
      else if(moji[j] == '0' && flag ==1){
	cout << write;
	flag=0;
	cnt=0;
      }
    }
    cout << endl;
  }
  return 0;
}

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

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

int main()
{
  int T;
  cin >> T;
  for (int t = 0; t < T; ++t) {
    string s;
    cin >> s;

    int index = 0, cnt = 0;
    for (unsigned int i = 0; i < s.size(); ++i) {
      if (index == 0) {
	index = s[i] - '0';
	cnt = 0;
      } else {
	if (s[i] == '0') {
	  cout << tbl[index][cnt%tbl[index].size()];
	  index = 0;
	} else {
	  ++cnt;
	}
      }
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;


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

int mod[10]={1,5,3,3,3,3,3,4,3,4};


int main(){
    
    int N;
    cin>>N;
    
    REP(i,N){
        string S;
        cin>>S;
        
        int cnt=0;
        string ans;
        
        REP(i,S.size()){
            if(S[i]!='0')cnt++;
            else{
                ans=ans+table[S[i-1]-'0'][(cnt-1)%mod[S[i-1]-'0']];
                cnt=0;
            }
        }
        
        cout<<ans<<endl;
        
    }
    
    return 0;
}