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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<17,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N;cin>>N;
        
        while(N--){
            string S;cin>>S;
            string T;
            
            int now=0,cnt=0;
            
            while(now<S.size()){
                if(S[now]=='0'){
                    now++;
                    continue;
                }
                cnt=0;
                while(S[now]==S[now+cnt]) cnt++;
                int rcnt=cnt;
                if(S[now]-'0'==1){
                    cnt%=5;
                    if(cnt==1) T+='.';
                    if(cnt==2) T+=',';
                    if(cnt==3) T+='!';
                    if(cnt==4) T+='?';
                    if(cnt==0) T+=' ';
                }
                if(S[now]-'0'==2){
                    cnt%=3;
                    if(cnt==1) T+='a';
                    if(cnt==2) T+='b';
                    if(cnt==0) T+='c';
                }
                if(S[now]-'0'==3){
                    cnt%=3;
                    if(cnt==1) T+='d';
                    if(cnt==2) T+='e';
                    if(cnt==0) T+='f';
                }
                if(S[now]-'0'==4){
                    cnt%=3;
                    if(cnt==1) T+='g';
                    if(cnt==2) T+='h';
                    if(cnt==0) T+='i';
                }
                if(S[now]-'0'==5){
                    cnt%=3;
                    if(cnt==1) T+='j';
                    if(cnt==2) T+='k';
                    if(cnt==0) T+='l';
                }
                if(S[now]-'0'==6){
                    cnt%=3;
                    if(cnt==1) T+='m';
                    if(cnt==2) T+='n';
                    if(cnt==0) T+='o';
                }
                if(S[now]-'0'==7){
                    cnt%=4;
                    if(cnt==1) T+='p';
                    if(cnt==2) T+='q';
                    if(cnt==3) T+='r';
                    if(cnt==0) T+='s';
                }
                if(S[now]-'0'==8){
                    cnt%=3;
                    if(cnt==1) T+='t';
                    if(cnt==2) T+='u';
                    if(cnt==0) T+='v';
                }
                if(S[now]-'0'==9){
                    cnt%=4;
                    if(cnt==1) T+='w';
                    if(cnt==2) T+='x';
                    if(cnt==3) T+='y';
                    if(cnt==0) T+='z';
                }
                now=now+rcnt+1;
            }
            
            cout<<T<<endl;
        }
        break;
    }
}

C++: #include<cstdio>

using namespace std;

int main(){
	char *dic[]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	int len[]={-1,5,3,3,3,3,3,4,3,4};
	int n;	scanf("%d",&n);
	while(n--){
		char s[80];	scanf("%s",s);
		char bef='@';
		int cnt=0;
		for(int i=0;s[i];i++){
			if(s[i]=='0'){
				if(cnt>0)	putchar(dic[bef-'0'][(cnt-1)%len[bef-'0']]);
				cnt=0;
				bef='@';
			}
			else{
				cnt++;
				bef=s[i];
			}
		}
		putchar('\n');
	}
	return 0;
}

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

int ch_num( char m ){
	if( m == '0' ) return 0 ;
	if( m == '1' ) return 1 ;
	if( m == '2' ) return 2 ;
	if( m == '3' ) return 3 ;
	if( m == '4' ) return 4 ;
	if( m == '5' ) return 5 ;
	if( m == '6' ) return 6 ;
	if( m == '7' ) return 7 ;
	if( m == '8' ) return 8 ;
	if( m == '9' ) return 9 ;
}

char word_map[9][6] = {
	{'.',',','!','?',' '} , // 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'} , // 4
	{'t','u','v','0','0'} ,
	{'w','x','y','z','0'} // 4
} ;

int main(){
	
	int n ;
	string s ;
	
	cin >> n ;
	for( int i=0 ; i<n ; i++ ){
		cin >> s ;
		for( int j=0 ; j<s.size() ; j++ ){
			int cnt = 0 , p = 3 ;
			char a = s[j] ;
			if( s[j] == '0' ) continue ;
			if( s[j] == '1' ) p = 5 ;
			if( s[j] == '6' || s[j] == '8' ) p = 4 ;
			for( j+=1 ; j<s.size() ; j++ ){
				if( s[j] == a ) cnt++ ;
				if( s[j] != a ) break ;
			}
			cout << word_map[ch_num(a)-1][cnt%p] ;
		}
		cout << endl ;
	}
	
return 0 ;
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string in;
    while(cin>>in){
        int i = 0;
        int n = in.length();
        
        while(i<n){
            int s = i;
            while(i<n && in[i]!='0'){
                i++;
            }
            if(0<i && in[i-1]-'0'!=0){
                string st = table[in[i-1]-'0'];
                cout << st[(i-s-1)%st.length()];
            }
            i++;
        }
        cout << endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <climits>

int n;
int a[1003];

int main() {
  while(scanf("%d", &n), n) {
    for (int i=0; i<n; i++) {
      scanf("%d", &a[i]);
    }

    int min_diff = INT_MAX;
    for (int i=0; i<n-1; i++) {
      for (int j=i+1; j<n; j++) {
	if (abs(a[i]-a[j]) < min_diff) {
	  min_diff = abs(a[i]-a[j]);
	}
      }
    }
    printf("%d\n", min_diff);
  }
}