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>

//??????????????????????????????????????????
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<stdio.h>
#include<string.h>
char c[9][6]={".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
char s[1025];
int main(){
	int n,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf(" %s",s);
		int len=strlen(s);
		int p=-1;
		int cnt=0;
		for(j=0;j<len;j++){
			if(s[j]=='0'){
				if(p==-1)continue;
				if(p==0)cnt%=5;
				else if(p==6||p==8)cnt%=4;
				else cnt%=3;
				printf("%c",c[p][cnt]);
				p=-1;
				cnt=0;
			}else{
				if(p==-1)p=s[j]-'1';
				else cnt++;
			}
		}
		puts("");
	}
	return 0;
}

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

int main() {
    vector<string> v;
    v.push_back(",.!? ");
    v.push_back("abc");
    v.push_back("def");
    v.push_back("ghi");
    v.push_back("jkl");
    v.push_back("mno");
    v.push_back("pqrs");
    v.push_back("tuv");
    v.push_back("wxyz");

    int N;
    cin >> N;
    while (N--) {
        string s;
        cin >> s;
        int x = 0, cnt = 0;
        for (char c : s) {
            if (c == '0') {
                x--;
                cnt--;
                if (x != -1) {
                    cout << v[x][cnt % v[x].size()];
                }
                x = 0;
            } else {
                if (x == 0) {
                    x = c - '0';
                    cnt = 1;
                } else {
                    cnt++;
                }
            }
        }
        cout << endl;
    }
}

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

int main(){

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

  int n;
  cin >> n;
  while( n-- ){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
      if(s[i] == '0') continue;
      int j = 0;
      while( s[i+j] != '0' ) j++;
      cout << str[ (int)s[i+j-1]-'1' ][ (j-1)%str[ (int)s[i]-'1' ].size()];
      i += j;
    }
    cout << endl;
  }
	return 0 ;
}

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

string order;
vector<int> num;
vector<char> word;
int n;
char button[9][4] = {{'.',',','!','?'},{'a','b','c'},{'d','e','f'},{'g','h','i'},{'i','k','l'},{'m','n','o'},{'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};

int main()
{
  int but = 0,push = 0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> order;
    for(int j=0;j<order.size();j++){
      num.push_back((int)(order[j]-'0'));
    }
    for(int j=0;j<num.size();j++){
      if(1<=num[j] && num[j]<=9 && but==0){
	but = num[j];
      }else if(1<=num[j] && num[j]<=9 && but!=0){
	push++; //cout << "pushed" << endl;
      }else if(num[j]==0 && but && but!=1 && but!=7 && but!=9){
	word.push_back(button[but-1][push%3]); //cout << button[but-1][push%3] << endl;
	push = 0;
	but = 0;
      }else if(num[j]==0 && but && (but==1 || but==7 || but==9)){
	word.push_back(button[but-1][push%4]); //cout << button[but-1][push%4] << endl;
	push = 0;
	but = 0;
      }else if(num[j]==0 && !but){
	continue;
      }
    }
    for(int k=0;k<word.size();k++){
      cout << word[k];
    }
    cout << endl;
    word.clear();
    num.clear();
  }
  
  return 0;
  
}

C++: #include <cstdio>
#include <cstdlib>
#define STR_MAX 1025

int main () {
  int n;
  int data[ 10 ][ 6 ] = {
    { 0,   0,   0,   0,   0,   0 },
    { 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 }
  };
  scanf( "%d", &n );
  for( int i = 0; i < n; i++ ) {
    char instr[ STR_MAX ];
    char outstr[ STR_MAX ];
    int si = 0;
    int counter = 1;
    int tmp = 0;
    scanf( "%s", instr );
    for( int j = 0; instr[ j ] != '\0'; j++ ) {
      if( instr[ j ] == '0' ) {
        if( counter != 1 ){
          outstr[ si++ ] = tmp;
        }
        counter = 1;
        continue;
      }
      if( counter == data[ instr[ j ] - '0' ][ 0 ] + 1 ) {
        counter = 1;
      }
      tmp = data[ instr[ j ] - '0' ][ counter++ ];
    }
    outstr[ si++ ] = '\0';
    puts( outstr );
  }

  return EXIT_SUCCESS;
}