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<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;
int main(void){

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

    int n; scanf("%d",&n);
    for(int i = 0;i < n;i++){
        char in[10000];
        scanf("%s",in);
        int cnt = -1;
        for(int i = 0;i < strlen(in);i++){
            if(in[i] == '0'){
                if(cnt == -1) continue;
                if(in[i-1] == '1'){
                    cnt %= 5;
                }
                else if(in[i-1] == '9'){
                    cnt %= 4;
                }
                else{
                    cnt %= 3;
                }
                printf("%c",str[in[i-1]-'0'][cnt]);
                cnt = -1;
            }
            else cnt++;
        }
        printf("\n");
    }

    return 0;
}

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


int X;
char s[1050];

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


int main(){

  cin >> X;
  while(X){

    cin >> s;

    int i = 0;
    char pre;
    int n;

    for(i = 0; i < strlen(s); i++){
      n = 1;
     
      pre = s[i];
      if(pre == '0') continue;
      while(pre == s[i+1] && i < strlen(s)){
	n++;
	i++;
      }
      int x = atoi(&pre);
   
      cout <<  b[x-1][(n-1) % b[x-1].length()];
    }
    cout << endl;
    X--;
  }
  return 0;
}

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

#define pb         push_back

const int INF = 100000000;

int main(void) {
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		string in;
		cin >> in;

		bool iflag = false;
		char ch;
		int cnt = 0;
		for(int j=0; j<in.size(); j++){
			if(in[j] == '0'){
				if(ch == '-') continue;
				cout << ch;
				cnt = 0;
				ch = '-';

			}else if(in[j] == '1'){
				switch(cnt){
					case 0:
						ch = '.';
						break;
					case 1:
						ch = ',';
						break;
					case 2:
						ch = '!';
						break;
					case 3:
						ch = '?';
						break;
					case 4:
						ch = ' ';
						break;
				}
				cnt++;
				if(cnt >= 5) cnt = 0;

			}else{
				ch = 'a' + (in[j] - '2') * 3 + cnt;
				cnt++;
				if(in[j] >= '8') ch++;
				if(in[j] == '7' || in[j] == '8'){
					if(cnt >= 4) cnt = 0;
				}else if(cnt >= 3) cnt = 0;
			}
		}
		cout << endl;
	}

	
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;
int main(void){

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

    int n; scanf("%d",&n);
    for(int i = 0;i < n;i++){
        char in[10000];
        scanf("%s",in);
        int cnt = -1;
        for(int i = 0;i < strlen(in);i++){
            if(in[i] == '0'){
                if(cnt == -1) continue;
                if(in[i-1] == '1'){
                    cnt %= 5;
                }
                else if(in[i-1] == '9' || in[i-1] == '7'){
                    cnt %= 4;
                }
                else{
                    cnt %= 3;
                }
                printf("%c",str[in[i-1]-'0'][cnt]);
                cnt = -1;
            }
            else cnt++;
        }
        printf("\n");
    }

    return 0;
}

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

int main()
{
	int n, p = 0, cnt = 0;
	string str, key[] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
	
	cin >> n;
	while (cin >> str) {
		for (char c : str) {
			n = c - '0';
			if (n) {
				cnt++;
			} else if (p != n) {
				cout << key[p][(cnt-1) % key[p].size()];
				cnt = 0;
			}
			p = n;
		}
		cout << endl;
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  vector<char> a[10];
  vector<char> ans;
  a[0].push_back('.');
  a[0].push_back(',');
  a[0].push_back('!');
  a[0].push_back('?');
  a[0].push_back(' ');
  a[1].push_back('a');
  a[1].push_back('b');
  a[1].push_back('c');
  a[2].push_back('d');
  a[2].push_back('e');
  a[2].push_back('f');
  a[3].push_back('g');
  a[3].push_back('h');
  a[3].push_back('i');
  a[4].push_back('j');
  a[4].push_back('k');
  a[4].push_back('l');
  a[5].push_back('m');
  a[5].push_back('n');
  a[5].push_back('o');
  a[6].push_back('p');
  a[6].push_back('q');
  a[6].push_back('r');
  a[6].push_back('s');
  a[7].push_back('t');
  a[7].push_back('u');
  a[7].push_back('v');
  a[8].push_back('w');
  a[8].push_back('x');
  a[8].push_back('y');
  a[8].push_back('z');
  char x;
  int n;
  cin>>n;
  
  scanf("%c",&x);
  int memo=-1,count=-1,z=0;
  for(int i=0;i<n;i++){
    while(1){
      scanf("%c",&x);
      if('0'<=x &&x<='9'){
	z=x-'0';
	if(z!=0){
	  memo=z;
	  count++;
	}
	else{
	  memo--;
	  if(memo==-2){
	    memo=-1;
	    continue;
	  }
	  count%=a[memo].size();
	  cout<<a[memo][count];
	  memo=-1;
	  count=-1;
	}
      }
      else{
	cout<<endl;
      break;
      }
    }
  }
  return 0;
}

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


void main(){
	char list[][6]={
	{"     "},
	{".,!? "},
	{"abc  "},
	{"def  "},
	{"ghi  "},
	{"jkl  "},
	{"mno  "},
	{"pqrs "},
	{"tuv  "},
	{"wxyz "} };
	int m[10] = {1,5,3,3,3,3,3,4,3,4};
	int count,n,i,buf;
	string str;
	cin >> n;
	while(n--){
		cin >> str;
		count=0;
		for(i=0;i<str.size() && str[i]=='0';i++);
		for(;i<str.size();i++){
			if(str[i]!='0'){
				count++;
			}else{
				if(str[i-1]!='0'){
				buf = (int)str[i-1] - (int)'0';
				cout << list[buf][(count-1) % m[buf]];
				count=0;
				}else{
					count=0;
				}
			}
		}
		cout << endl;
	}
}

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

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

string solve(string in){
  string res="";
  int c=0;
  int n_in=0;
  for(int i=0;i<in.size();i++){
    int t_in=in[i]-'0';
    if(t_in==0){
      if(n_in!=0){
        res+=push[n_in][(c%push[n_in].size())];
      }
      n_in=0;
      c=0;
    }else{
      if(t_in==n_in){
        c++;
      }else{
        c=0;
	n_in=t_in;
      }
    }
  }
  return res;
}



int main(){
  string in;
  while(cin>>in){
    string ans=solve(in);
    if(ans.size()!=0){
      cout<<ans<<endl;
    }
  }
}