Go: /*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2006&lang=jp
Keitai Message
*/

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// 標準入力を取得するScannerのインスタンスを作成
var scanner = bufio.NewScanner(os.Stdin)

// 標準入力で各行を読み込みstringとして返す
func readLine() string {
	if scanner.Scan() {
		return scanner.Text()
	}
	return ""
}

func main() {
	// 1: . , ! ? (スペース)
	// 2: a b c
	// 3: d e f
	// 4: g h i
	// 5: j k l
	// 6: m n o
	// 7: p q r s
	// 8: t u v
	// 9: w x y z
	// 0: 確定ボタン

	// 改行から空白区切りに変更
	scanner.Split(bufio.ScanWords)
	line, _ := strconv.Atoi(readLine()) // 5行標準入力が続く

	table := []string{
		"",      // 0 index調整ためダミーデータ
		".,!? ", // 1
		"abc",   // 2
		"def",   // 3
		"ghi",   // 4
		"jkl",   // 5
		"mno",   // 6
		"pqrs",  // 7
		"tuv",   // 8
		"wxyz"}  // 9

	// 5行分の標準入力を格納するsliceを作成する
	messages := make([]string, 0, line)

	// sliceに標準入力の内容を格納する
	for i := 0; i < line; i++ {
		messages = append(messages, readLine()) // messages=[20 220 222220 44033055505550666011011111090666077705550301110 000555555550000330000444000080000200004440000]
	}

	// 各行毎に解析する
	for _, message := range messages { // message=000555555550000330000444000080000200004440000
		// 0で分割する
		messageSlice := strings.Split(message, "0") // messageSlice=[   55555555    33    444    8    2    444    ]
		for _, word := range messageSlice {
			if word == "" {
				// NOP.
				// 0をセパレーターにしているので空文字がsliceに格納されてい箇所がある
				// 何もしない
			} else { // word=55555555
				// 一文字取り出しコード値をASCII文字に変換する
				ascii := string((word[0])) // word[0]=5

				// ASCII文字からintへ変換する(tableのindexになる)
				number, _ := strconv.Atoi(ascii)

				// 入力回数をカウントする
				count := len(word) // 5

				// 同じ数字を続けて入力すると変化する文字はループすることを考慮する
				for count > len(table[number]) { // 5 > 3
					count -= len(table[number]) // 2
				}

				// キー配列
				keys := table[number]                   //jkl
				fmt.Printf("%s", string(keys[count-1])) //k
			}
		}
		fmt.Println() // 改行
	}
}

C++: #include<iostream>

using namespace std;

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

char now,before;
string in;


void solve(){
  now = '\n';
  before = 'N';
  int c=0,r=0;
  int index = 0;
  while(in[index++] == '0');
  
  for(int i = index-1; i < in.length(); i++){
    if(in[i] == '0'){
      if(c+r){
	now = s[c][r%s[c].length()];
	cout << now;
	c = r =0;
      }
    }else if(before == in[i]){
      r++;
    }else{
      c = in[i]-'0';
      r = 0;
    }
    before = in[i];
  }
  cout << endl;
}

int main(){
  int N;
  cin >> N;
  while(N--){
    cin.ignore();
    while(getline(cin,in)) solve();
  }
  return 0;
}

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

int main(){

	char data[10][5] = {'E','E','E','E','E',
					'.', ',', '!' ,'?' ,' ',
					'a', 'b', 'c', 'E', 'E',
					'd','e','f','E','E',
					'g','h','i','E','E',
					'j','k','l','E','E',
					'm','n','o','E','E',
					'p','q','r','s','E',
					't','u','v','E','E',
					'w','x','y','z','E'};

	char in;
	int col=-1, row=0;
	int num;
	int state = 0;
	while(scanf("%c",&in) != EOF){

		if(in == '0'){
			if(col == -1) col++;
			if(row >= 2 && row <= 6 || row == 8) num = 3;
			else if(row == 1) num = 5;
			else num = 4;

			if(data[row][col%num] != 'E'){
				cout << data[row][col%num];
				state = 1;
			}
			col = -1;
			row = 0;
		}else{
			col++;
			row=in-48;
		}
		if(in == '\n'){
			if(state == 1) cout << endl;
			state = 0;
			col = -1;
			row = 0;
		}

	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
struct keitai{
    int key=0,val=0;
    vs d={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    void in(int k){
        if(key==k)val++;
        else{
            if(key) cout<<d[key][val%d[key].size()];
            key=k,val=0;
        }
    }
};
int main(void){
    int n;
    cin>>n;
    rep(i,n){
        keitai k;
        string s;
        cin>>s;
        for(auto c:s){
            k.in(c-'0');
        }
        cout<<endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
int exec();

class Line {
  public:
    string line;
    int i, n;
    Line(string _line) {
      line = _line;
      i = 0;
      read();
    }
    int read() {
      stringstream ss;
      ss << line[i];
      ss >> n;
      // n = static_cast<int>(line[i]);
    }
    bool next() {
      ++i;
      if(i == line.size()) return false;
      read();
      return true;
    }
    int get() {
      return n;
    }
};

int main() {
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i) exec();
  return 0;
}

int exec() {
  vector<vector<char> > chars = {{'.', ',', '!', '?', ' '}, {'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, count;
  string line;
  cin >> line;
  Line pattern(line);
  while(true) {
    count = 0;
    while(!(n = pattern.get())) if(!pattern.next()) {
      cout << endl;
      return 0;
    }
    while(pattern.next(), pattern.get()) ++count;
    cout << chars[n - 1][count % (chars[n - 1].size())];
  }
  return 0;
}

C++: #include<string>
using namespace std;
string search(int n[]) {
	if (n[0]) {
		if (n[0]%5 == 1) {
			n[0] = 0;
			return ".";
		}
		else if (n[0]%5 == 2) {
			n[0] = 0;
			return ",";
		}
		else if (n[0]%5 == 3) {
			n[0] = 0;
			return "!";
		}
		else if(n[0]%5==4) {
			n[0] = 0;
			return "?";
		}
		else {
			n[0] = 0;
			return " ";
		}
	}
	else if (n[1]) {
		if (n[1] % 3 == 1) {
			n[1] = 0;
			return "a";
		}
		else if (n[1] % 3 == 2) {
			n[1] = 0;
			return "b";
		}
		else {
			n[1] = 0;
			return "c";
		}
	}
	else if (n[2]) {
		if (n[2] % 3 == 1) {
			n[2] = 0;
			return "d";
		}
		else if (n[2] % 3 == 2) {
			n[2] = 0;
			return "e";
		}
		else {
			n[2] = 0;
			return "f";
		}
	}
	else if (n[3]) {
		if (n[3] % 3 == 1) {
			n[3] = 0;
			return "g";
		}
		else if (n[3] % 3 == 2) {
			n[3] = 0;
			return "h";
		}
		else {
			n[3] = 0;
			return "i";
		}
	}
	else if (n[4]) {
		if (n[4] % 3 == 1) {
			n[4] = 0;
			return "j";
		}
		else if (n[4] % 3 == 2) {
			n[4] = 0;
			return "k";
		}
		else {
			n[4] = 0;
			return "l";
		}
	}
	else if (n[5]) {
		if (n[5] % 3 == 1) {
			n[5] = 0;
			return "m";
		}
		else if (n[5] % 3 == 2) {
			n[5] = 0;
			return "n";
		}
		else {
			n[5] = 0;
			return "o";
		}
	}
	else if (n[6]) {
		if (n[6] % 4 == 1) {
			n[6] = 0;
			return "p";
		}
		else if (n[6] % 4 == 2) {
			n[6] = 0;
			return "q";
		}
		else if (n[6] % 4 == 3) {
			n[6] = 0;
			return "r";
		}
		else {
			n[6] = 0;
			return "s";
		}
	}
	else if (n[7]) {
		if (n[7] % 3 == 1) {
			n[7] = 0;
			return "t";
		}
		else if (n[7] % 3 == 2) {
			n[7] = 0;
			return "u";
		}
		else {
			n[7] = 0;
			return "v";
		}
	}
	else if (n[8]) {
		if (n[8] % 4 == 1) {
			n[8] = 0;
			return "w";
		}
		else if (n[8] % 4 == 2) {
			n[8] = 0;
			return "x";
		}
		else if (n[8] % 4 == 3) {
			n[8] = 0;
			return "y";
		}
		else {
			n[8] = 0;
			return "z";
		}
	}
	return "";
}


int main() {
	int i;
	cin >> i;
	string num;
	string s;
	int n[9] = {};
	for (int j = 0; j<i; j++) {
		cin >> num;
		for (int j = 0; j < num.size() ; j++) {
			switch (num[j]) {
			case '1':
				n[0]++;
				break;
			case '2':
				n[1]++;
				break;
			case '3':
				n[2]++;
				break;
			case '4':
				n[3]++;
				break;
			case '5':
				n[4]++;
				break;
			case '6':
				n[5]++;
				break;
			case '7':
				n[6]++;
				break;
			case '8':
				n[7]++;
				break;
			case '9':
				n[8]++;
				break;
			default:
					s += search(n);
			}
		}
		cout << s << endl;
		s = "";
	}
}