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

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

var table = []string{
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz",
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)

	for i := 0; i < n; i++ {
		message := nextString(sc)
		currentButton, count := 0, 0
		for _, word := range message {
			// 確定の処理を書く
			if word == '0' {
				if currentButton == 0 {
					count = 0
					continue
				}
				mod := len(table[currentButton])
				tmp := table[currentButton][(count-1)%mod]
				currentButton, count = 0, 0
				fmt.Printf("%c", tmp)
			} else {
				count++
				currentButton = int(word) - 48 // '0'はASCIIで48
			}
		}
		fmt.Println()
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

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

char judge(char C, int c){

	  if(C == '1'){
	     if(c % 5 == 1){
	       return '.';
	   } else if(c % 5 == 2){
	     return ',';
	     } else if(c % 5 == 3){
	       return '!';
	   } else if(c % 5 == 4){
	     return '?';
	      } else if(c % 5 == 0){
	       return ' ';
	    }
	 } else if(C == '2'){
	   if(c % 3 == 1){
	    return 'a';
	     } else if(c % 3 == 2){
		   return 'b';
		    } else if(c % 3 == 0){
		    return 'c';
	   }
	  } else if(C == '3'){
      if(c % 3 == 1){
       return 'd';
    } else if(c % 3 == 2){
      return 'e';
      } else if(c % 3 == 0){
       return 'f';
    }
    } else if(C == '4'){
    if(c % 3 == 1){
     return 'g';
     } else if(c % 3 == 2){
       return 'h';
    } else if(c % 3 == 0){
     return 'i';
      }
  } else if(C == '5'){
      if(c % 3 == 1){
      return 'j';
   } else if(c % 3 == 2){
      return 'k';
      } else if(c % 3 == 0){
      return 'l';
    }
    } else if(C == '6'){
    if(c % 3 == 1){
      return 'm';
     } else if(c % 3 == 2){
        return 'n';
    } else if(c % 3 == 0){
      return 'o';
      }
	  } else if(C == '7'){
      if(c % 4 == 1){
        return 'p';
    } else if(c % 4 == 2){
		return 'q';
      } else if(c % 4 == 3){
       return 'r';
    } else if(c % 4 == 0){
      return 's';
      }
    } else if(C == '8'){
	 if(c % 3 == 1){
	     return 't';
	     } else if(c % 3 == 2){
	      return 'u';
	    } else if(c % 3 == 0){
	      return 'v';
	      }
	  } else if(C == '9'){
	    if(c % 4 == 1){
	        return 'w';
	    } else if(c % 4 == 2){
	      return 'x';
	      } else if(c % 4 == 3){
	       return 'y';
	    } else if(c % 4 == 0){
	      return 'z';
				      }
	  }

}


int main(void) {
	int n, c, count = 0, i = 0;
	char st[2], str[77], nowc;

	cin.tie(0);

	cin >> n;
	fgets(st, 2, stdin);

	for (int k = 0; k < n; k++) {
		while ((c = getchar()) != '\n') {

			if (count == 0 && c == '0') {
				continue;
			} else if (count == 0 && c != '0') {
				nowc = (char)c;
				count++;
			} else if (count != 0 && c == '0') {
				str[i++] = judge(nowc, count);
				count = 0;
			} else if (count != 0 && c != 0) {
				count++;
			}
		}
		str[i] = '\0';
		if (i != 0) cout << str << "\n";
		strcpy(str, "");
		count = 0;
		i = 0;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>

using namespace std;

vector<vector<char> > data;

string parse(string msg){
  string res = "";
  int state = 0;
  int time = 0;
  for(auto c : msg){
    if(c == '0'){
      if(time % data[state-1].size() == 0){
        res += data[state-1][data[state-1].size() - 1];
      }else{
        res += data[state-1][time % data[state-1].size() - 1];
      }
      time = 0;
    }else{
      int num = c - '0';
      if(state != num){
        state = num;
        time = 1;
      }else{
        time++;
      }
    }
  }
  return res;
}

void init(){
  data.push_back({'.',',','!','?',' '});
  data.push_back({'a','b','c'});
  data.push_back({'d','e','f'});
  data.push_back({'g','h','i'});
  data.push_back({'j','k','l'});
  data.push_back({'m','n','o'});
  data.push_back({'p','q','r','s'});
  data.push_back({'t','u','v'});
  data.push_back({'w','x','y','z'});
}

int main(){
  int n;
  string msg;
  init();
  cin >> n;
  for(int i=0;i<n;i++){
    cin>> msg;
    cout << parse( msg ) << endl;
  }
  return 0;
}

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

int main(){
  int n;
  string bottan[]={
    ".,!? ", // 1
    "abc", // 2
    "def", // 3
    "ghi", // 4
    "jkl", // 5
    "mno", // 6
    "pqrs", // 7
    "tuv", // 8
    "wxyz", // 9
  };
  int cnt[] = {5,3,3,3,3,3,4,3,4};
  
  cin >> n;
  while(n--){
    string str; cin >> str;
    int len = str.size();
    int cnt1=0,cnt2=0;
    for(int i=0;i<len;i++){
      if(str[i] == '0' && cnt1 != 0){
	cout << bottan[cnt1-1][cnt2];
	cnt1 = 0; cnt2 = 0;
      }
      else {
	if(cnt1 == 0){
	  cnt1 = str[i] - '0';
	}
	else {
	  cnt2 = cnt2+1%cnt[cnt1-1];
	}
      }
    }
    cout << endl;
  }
}

C++: /*
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
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  vector<int> v[9];
  int cnt=0;
  v[0].push_back('.');v[0].push_back(',');v[0].push_back('!');v[0].push_back('?');v[0].push_back(' ');
  for(int i=1;i<=5;i++){
      for(int j=0;j<3;j++){
          v[i].push_back('a'+cnt);
          cnt++;
      }
  }
  v[6].push_back('p');v[6].push_back('q');v[6].push_back('r');v[6].push_back('s');
  v[7].push_back('t');v[7].push_back('u');v[7].push_back('v');
  v[8].push_back('w');v[8].push_back('x');v[8].push_back('y');v[8].push_back('z');

  int n;
  cin >> n;
  string s;
  for(int i=0;i<n;i++){
      string res="";
    cin >> s;
    int pre=0,num=0;
    for(int j=0;j<(int)s.length();j++){
      if(s[j]=='0'){
          if(num==0&&pre==0) continue;
          res.push_back(v[pre-1][num%(v[pre-1].size())]);
          //cout<<res<<endl;
          num=0;pre=0;
      }
      else{
          if(pre) num++;
          else pre=(s[j]-'0');
      }
    }
    cout<<res<<endl;
  }
}

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

int main() {
    int N;
    cin >> N;
    while (N--) {
        string s;
        
        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");
        
        while (cin >> s) {
            string p;
            char buf = 0;
            int c = 0;
            for (int i = 0; i < s.size(); i++) {
                if (s[i] == '0') {
                    if (buf > 0)
                        p += v[buf - '0' - 1][(c - 1) % v[buf - '0' - 1].size()];
                    buf = 0;
                    c = 0;
                } else {
                    buf = s[i];
                    c++;
                }
            }
            
            cout << p << endl;
        }
    }

    return 0;
}