Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [6][5]string{
		{"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", ".", "?", "!", " "},
	}
	for scanner.Scan() {
		input := strings.Split(scanner.Text(), "")
		if len(input)%2 != 0 {
			fmt.Println("NA")
			continue
		}
		ret := make([]string, 0)
		for i := 0; i < len(input); i += 2 {
			row, _ := strconv.Atoi(input[i])
			col, _ := strconv.Atoi(input[i+1])
			ret = append(ret, table[row-1][col-1])
		}
		fmt.Println(strings.Join(ret, ""))
	}
}

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

using namespace std;

int main(void){
  string arg;

  while(cin >> arg){
	int n=arg.size();
	int tmpi;
	char tmpc;
	string str = "";
	bool ok = true;
	if(n%2==1){
	  cout << "NA" << endl;
	  continue;
	}
	for(int i=0;i<n/2;i++){
	  tmpi = 0;
	  tmpc = arg[i*2];
	  tmpi += (tmpc - '0') * 10;
	  tmpc = arg[i*2+1];
	  tmpi += tmpc - '0';
	  switch(tmpi){
	  case 11:
		str +="a";
		break;
	  case 12:
		str +="b";
		break;
	  case 13:
		str +="c";
		break;
	  case 14:
		str +="d";
		break;
	  case 15:
		str +="e";
		break;
	  case 21:
		str +="f";
		break;
	  case 22:
		str +="g";
		break;
	  case 23:
		str +="h";
		break;
	  case 24:
		str +="i";
		break;
	  case 25:
		str +="j";
		break;
	  case 31:
		str +="k";
		break;
	  case 32:
		str +="l";
		break;
	  case 33:
		str +="m";
		break;
	  case 34:
		str +="n";
		break;
	  case 35:
		str +="o";
		break;
	  case 41:
		str +="p";
		break;
	  case 42:
		str +="q";
		break;
	  case 43:
		str +="r";
		break;
	  case 44:
		str +="s";
		break;
	  case 45:
		str +="t";
		break;
	  case 51:
		str +="u";
		break;
	  case 52:
		str +="v";
		break;
	  case 53:
		str +="w";
		break;
	  case 54:
		str +="x";
		break;
	  case 55:
		str +="y";
		break;
	  case 61:
		str +="z";
		break;
	  case 62:
		str +=".";
		break;
	  case 63:
		str +="?";
		break;
	  case 64:
		str +="!";
		break;
	  case 65:
		str +=" ";
		break;
	  default:
		ok = false;
	  }
	  if(!ok) break;
	}
	if(ok){
	  cout << str << endl;
	}else{
	  cout << "NA" << endl;
	}
  }
}

C++: #include<iostream>
#include<string>
#define rep(i,x) for(int i=0;i<x;i++)
using namespace std;
string s;
char tab[10][10]={"abcde","fghij","klmno","pqrst","uvwxy","z.?! "};
void solve(){
	int n=0,k=0;
	char ans[1000];
	if(s.size()%2!=0){
		cout<<"NA"<<endl;
		return ;
	}
	else{
		while(n<s.size()){
			if(s[n]>='1'&&s[n]<'7'&&s[n+1]>='1'&&s[n+1]<'6')
			ans[k++]=tab[s[n]-1-'0'][s[n+1]-1-'0'];
			else{

				cout<<"NA"<<endl;
				return ;
			}
			n+=2;
		}
		rep(i,k)
		cout<<ans[i];
		cout<<endl;
	}
}
int main(){
	while(cin>>s){
		solve();
	}
	return 0;
}

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

int main()
{
	char tb[9][9];
	for(int i=1; i<=7; i++)
	for(int j=1; j<=6; j++)
		tb[i][j]='a'+(5*(i-1)+j-1);
		
	tb[6][2]='.';
	tb[6][3]='?';
	tb[6][4]='!';
	tb[6][5]=' ';
	
	string b;
	while(cin >> b)
	{
		string res;
		bool g=true;
		if(b.size()%2==1) g=false;
		else
		{
			for(int i=0; i<b.size(); i+=2)
			{
				int f=b[i]-'0', s=b[i+1]-'0';
				if(f>6||s>5)
				{
					g=false;
					break;
				}
				res+=tb[f][s];
			}
		}
		
		if(g) cout << res << endl;
		else cout << "NA" << endl;
		
	}
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <fstream>
#include <sstream>
#include <math.h>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

char translation_table[6][5] = {'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 main(){
    string input;
    while(cin>>input){
        if(input.length()%2!=0)cout<<"NA"<<endl;
        else{
            string ans;
            for(int i=0; i<input.length(); i++){
                int y = input[i]-'0';
                i++;
                int x = input[i]-'0';
                if(y<=6&&x<=5&&0<y&&0<x){
                    ans+=translation_table[y-1][x-1];
                }else{
                    ans = "NA";
                    break;
                }
            }
            
            cout<<ans<<endl;
        }
    }

}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

char *dic = "abcdefghijklmnopqrstuvwxyz.?! ";

int main() {
	for(string line; cin >> line;) {
		if(line.length() & 1) {
			cout << "NA" << endl;
			continue;
		}
		bool ok = true;
		int n = line.length();
		for(int i = 0; i < n; i += 2) {
			int c = line[i] - '0';
			if(c > 6) ok = false;
			c = line[i + 1] - '0';
			if(c > 5) ok = false;
		}
		if(!ok) {
			cout << "NA" << endl;
			continue;
		}
		for(int i = 0; i < n; i += 2) {
			cout << dic[5 * (line[i] - '0' - 1) + (line[i + 1] - '0' - 1)];
		}
		cout << endl;
	}
	return 0;
}

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

int main()
{
    char a[5][6];
    for( int j = 0; j < 6; j++ )
        for( int i = 0; i < 5; i++ )
            a[i][j] = 'a' + i + j * 5;

    a[1][5] = '.';
    a[2][5] = '?';
    a[3][5] = '!';
    a[4][5] = ' ';

    string str;

    while( cin >> str )
    {
        if( str.size() % 2 != 0 )
            cout << "NA" << endl;
        else
        {
            string res = "";
            for( int i = 0; i < str.size() - 1; i += 2 )
            {
                if( 0 < str[i]-'0' && str[i] - '0' <= 6 && 0 < str[i+1]-'0' && str[i+1] - '0' <= 5 )
                    res += a[str[i+1]-'0'-1][str[i]-'0'-1];                                 //配列の添え字注意。列から行を見る。
                else
                {
                    res = "NA";
                    break;
                }
            }
            cout << res << endl;
        }
    }

    return 0;
}