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;

int main(void){

    vector<vector<char> > number(10);
    number[1].push_back('.');
    number[1].push_back(',');
    number[1].push_back('!');
    number[1].push_back('?');
    number[1].push_back(' ');

    number[2].push_back('a');
    number[2].push_back('b');
    number[2].push_back('c');

    number[3].push_back('d');
    number[3].push_back('e');
    number[3].push_back('f');

    number[4].push_back('g');
    number[4].push_back('h');
    number[4].push_back('i');

    number[5].push_back('j');
    number[5].push_back('k');
    number[5].push_back('l');

    number[6].push_back('m');
    number[6].push_back('n');
    number[6].push_back('o');

    number[7].push_back('p');
    number[7].push_back('q');
    number[7].push_back('r');
    number[7].push_back('s');

    number[8].push_back('t');
    number[8].push_back('u');
    number[8].push_back('v');

    number[9].push_back('w');
    number[9].push_back('x');
    number[9].push_back('y');
    number[9].push_back('z');    

    int n; cin >> n;
    for(int i = 0; i < n; i++){
        string str; cin >> str;
        int j = 0;
        while(str[j] != '\0'){
            int counter = 0;
            if(str[j] == '0'){ 
                j++;
                continue;
            }
            while(str[j] != '0'){
                counter++;
                j++;
            }
            //cout << j - 1 << endl;
            //cout << str[j - 1] << endl;
            //int a = str[j - 1];
            //cout << counter << endl;
            //cout << a << endl;
            //cout << number[ a ].size() << endl;
            //cout << number[2].size() << endl;
            //cout << counter / number[j - 1].size() << endl;
            //cout << counter << " " << str[j - 1] << endl;
            cout << number[(int)str[j - 1] - '0'][(counter-1) % number[(int)str[j - 1] - '0'].size()];
            j++;
        }

        cout << endl;
    }

    return 0;
}

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

int main() {
    vector<vector<char>> v = { {'.', ',', '!', '?', ' '},
                               {'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;
    for(int i=0; i<n; ++i) {
        string str;
        cin >> str;
        int counter = -1;
        int id = -1;
        for(int j=0; j<str.size(); ++j) {
            char c = str[j];
            if(c == '0' && id != -1) {
                cout << v[id][counter];
                id = -1;
                counter = -1;
            } else if(c != '0') {
                id = static_cast<int>(c - '0' - 1);
                counter = (counter+1)%v[id].size();
            }
        }
        cout << endl;
    }
}

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

using namespace std;

int main(void){
	vector<vector<string>> moji{
		{}, 
		{".",",","!","?"," "},
		{"a","b","c"},
		{"d","e","f"},
		{"f","h","i"},
		{"j","k","l"},
		{"m","n","o"},
		{"p","q","r","s"},
		{"t","u","v"},
		{"w","x","y","z"}
	};

	int num;
	cin >> num;
	for(int i = 0; i < num; i++){
		int count = 0;
		string str;
		cin >> str;
		string one = "0";

		for(int j = 0; j < str.size(); j++){
			if(str[j] == '0'){
				if(one != "0"){
					count--;
					cout << moji[stoi(one)][count % moji[stoi(one)].size()];
				}
				one = str[j];
				count = 0;
			}else{
				one = str[j];
				count++;
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	int n; cin >> n;
	string s[10];
	s[0] = '0';
	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";
	for (int i = 0; i < n; i++) {


		string num;
		cin >> num;
		for (int j = 0; j < num.size(); j++) {
			if (j == 0) {
				if (num[j] == '0') {
					continue;
				}
			}

			else if (num[j - 1] == '0'&&num[j] == '0') {
				continue;
			}
			int t = 0;
			while (num[j + t] != '0')t++;
			switch (num[j]) {
			case '1':cout << s[1][(t - 1) % 5]; break;
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':cout << s[num[j] - '0'][(t - 1) % 3]; break;
			case '7':cout << s[7][(t - 1) % 4]; break;
			case '8':cout << s[num[j] - '0'][(t - 1) % 3]; break;
			case '9':cout << s[9][(t - 1) % 4]; break;
			default:break;
			}
			j += t;
		}
		cout << endl;






	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
using namespace std;
int main(){
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		string key[]={".,!?, ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
		string input;
		cin>>input;
		stringstream b(input);
		int num=0,count=0;
		while(1){
			char c;
			if(b>>c)break;
			int input=c-'0';
			if(input!=0){
				count++;
				num=input;
			}
			else {
				if(count!=0)
					count<<key[num-1][count%key[num-1].size()];
				num=0;count=0;
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string c[11] = {"",
		".,!? ",
		"abc",
		"def",
		"ghi",
		"jkl",
		"mno",
		"pqrs",
		"tuv",
		"wxyz"};
int main(void){
  int n;
  cin >> n;
  string s;
  for(int i = 0; i < n; i++){
    string res;
    cin >> s;
    char a = '0';
    int b = 0;
    for(int j = 0; j < (int)s.size(); j++){
      if(s[j] == a){
	b++;
      }else{
	if(a-'0')
	  res += c[a-'0'][b%(int)c[a-'0'].size()];
	a = s[j];
	b = 0;
      }
    }
    cout << res << endl;
  }
}