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<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;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
 string a[9] = {".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
 int n;
 cin >> n;
 for(int k=0; k<n; k++){
   string s;
   cin >> s;
   for(int i=0; i<(int)s.size(); i++){
     char c = s[i];
     int count = 0;
     for(i=i+1; i<(int)s.size(); i++){
       if(s[i] != c) break;
       count++;
    }
    i--;
    if(c=='0') continue;
    int num = c-'0'-1;
    int tmp = count % a[num].size();
    cout << a[num][tmp];
    }
    cout << endl;
 }
 return 0;
}

C++: #include<cstdio>
int main(){
	char C[10][6]={{},{'.',',','!','?',' ', 5 },{'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 , 3 },{'p','q','r','s', 0 , 4 },{'t','u','v', 0 , 0 , 3 },{'w','x','y','z', 0 , 4 }},s[1025],c;
	int n,i,p;
	scanf("%d",&n);
	for(i=n;p=-1,scanf("%s",s),i;puts(""),--i){
		for(n=0;s[n];++n)
			(s[n]-48)?
				p++
			:
				p=-1,c=0,!c?printf("%c",C[s[n]-48][p%C[s[n]-48][5]]):0;

	}
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[1080], b[1080];
int n, m;

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

char _str[10800];
void output(int val, int cnt){
	if(val == 0)return;
	cout << button[val][(cnt-1) % button[val].size()];
}


int main(){
	while(~scanf(" %s", _str)){
		str = _str;
		int val = 0;
		int cnt = 0;
		for(int i = 0;i < str.size();i++){
			if(str[i] == '0'){
				output(val, cnt);
				val = cnt = 0;
			}
			else{
				val = str[i] - '0';
				cnt++;
			}
		}
		output(val, cnt);
		cout << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  V<string> c(10);
  c[1] = ".,!? ";
  c[2] = "abc";
  c[3] = "def";
  c[4] = "ghi";
  c[5] = "jkl";
  c[6] = "mno";
  c[7] = "pqrs";
  c[8] = "tuv";
  c[9] = "wxyz";
  int q; cin >> q;
  while (q--) {
    string s; cin >> s;
    int n = s.size();
    string res;
    char curr = 0;
    int j = 0;
    for (int i = 0; i < n; ++i) {
      if (s[i] == '0') {
        if (curr) res += curr;
        curr = 0;
        j = 0;
      } else {
        curr = c[s[i] - '0'][j++ % c[s[i] - '0'].size()];
      }
    }
    cout << res << '\n';
  }
}