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])
			// log.Println(table[row-1][col-1])
			ret = append(ret, table[row-1][col-1])
		}
		fmt.Println(strings.Join(ret, ""))
	}
}

C++: #include <iostream>

using namespace std;

char 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 temp[2];

int main() {

    string mes;

    while (cin>>mes) {

        if (mes.length()%2!=0) cout << "NA" << endl;

        else {

            string temp="", res="";

            for (int i=0; i<mes.length(); i++) {

                if (i%2!=0) {

                    temp[1] = mes[i] - '0';

                    if (temp[0]<1||temp[1]<1||temp[0]>6||temp[1]>6) {
                        res = "NA";
                        break;
                    } else {
                        res += table[temp[0]-1][temp[1]-1];
                    }

                } else temp[0] = mes[i] - '0';

            }

            cout << res << endl;

        }

    }

}

C++: #include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
    char l[6][6]={{0}};
    for(int i=0;i<5;i++){
        for(int j=0;j<5;j++)
            l[i][j]='a'+i*5+j;
    }
    strcpy(l[5],"z.?! ");

    char str[256];
    while(scanf("%s",str)!=EOF){
        if(strlen(str)&1){
            puts("NA");
            continue;
        }
        char ans[128]={0};
        for(int i=0;str[i];i+=2){
            int v1=str[i]-'0'-1,v2=str[i+1]-'0'-1;
            if(v1<0||v1>=6||v2<0||v2>=5){
                puts("NA");
                break;
            }
            ans[i/2]=l[v1][v2];
        }
        printf("%s\n",ans);
    }
    return 0;
}

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

using namespace std;

char c[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(){
	
	bool checker;
	
	string str;
	
	while(true){
		cin >> str;
		if(cin.eof()){
			break;
		}
		
		checker = false;
		
		for(int i = 0; i < str.size(); i++){
			if(str[i] < '1' || str[i] > '6'){
				printf("NA\n");
				checker = true;
				break;
			}
		}
		
		if(checker){
			continue;
		}
		
		if(str.size() % 2 != 0){
			printf("NA\n");
			continue;
		}
		for(int i = 0; i < str.size(); i += 2){
			if(str[i + 1] - '0' - 1 >= 5){
				printf("NA");
				break;
			}
			printf("%c", c[str[i] - '0' - 1][str[i + 1] - '0' - 1]);
		}
		printf("\n");
	}
	
	return 0;
}

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

// infty
#define ULLINF (ULLONG_MAX)
#define LLINF  (LLONG_MAX)
#define IINF   (INT_MAX)
#define INF    (1<<29)

// math
#define Sq(x) ((x)*(x))

// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)

// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;

typedef long long ll;

// pair util
#define FST first
#define SND second

// range validator
#define CK(n,a,b) (a<=n && n<b)

// conversion
template<class T> inline string toStr(T a) { ostringstream oss_; oss_ << a; return oss_.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }

// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }

int const dx[] = {-1,0,1,0,-1,1,1,-1};
int const dy[] = {0,-1,0,1,-1,-1,1,1};

//////////////////////////////////////////////////////////////


int main() {
  
  string s;
  while(cin >> s) {
    
    int const N = s.size();
    
    if(N%2) {
      cout << "NA" << endl;
      continue;
    }
    
    string output;
    
    for(int i=0; i<N; i+=2) {
      int a = s[i]-'0'-1; if(!CK(a, 0, 6)) { cout << "NA" << endl; goto EXIT; }
      int b = s[i+1]-'0'-1; if(!CK(b, 0, 5)) { cout << "NA" << endl; goto EXIT; }
      
      char ch = (char)('a' + a*5+b);
      if(!CK(ch,'a','z'+1)) {
	if(b == 1 && a == 5) ch = '.';
	else if(b == 2 && a == 5) ch = '?';
	else if(b == 3 && a == 5) ch = '!';
	else if(b == 4 && a == 5) ch = ' ';
	else { cout << "NA" << endl; goto EXIT; }
      }
      output += ch;
    }
    cout << output << endl;
    
  EXIT:;
  }
  
  return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
    char ch[10][10]={ {'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','.','?','!',' '} };
    string s;
    while(cin>>s){
        int len=s.size();
        string ans="";
        
        try{
            if(len%2==1)throw 1;
            for(int i=0;i<len;i+=2){
                int a,b;
                if(s[i]<'1' || '6'<s[i] || s[i+1]<'1' || '5'<s[i+1] )throw 1;
                a=s[i]-'0'-1;
                b=s[i+1]-'0'-1;
            
                ans+=ch[a][b];
            }
        }catch(int a){
            cout<<"NA"<<endl;
            goto next;
        }
        cout<<ans<<endl;
        next:;
    }
}

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


int main(){
    char map[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', '.', '?', '!', ' '}};

    string s;
    while (cin >> s){
	bool err = false;
	for (int i = 0; i < s.size(); i++){
	    if (i % 2 && (s[i] > '5' || s[i] < '0')) err = true;
	    else if (i % 2 == 0 && (s[i] > '6' || s[i] < '0')) err = true;
	}
	if (s.size() % 2 || err) cout << "NA" << endl;

	else {
	    for (int i = 0; i < s.size(); i+=2){
		cout << map[s[i]-'0'-1][s[i+1]-'0'-1];
	    }
	    cout << endl;
	}
    }
}

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

int main()
{
	string table[6] = { "abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! " };
	string s;
	int a,b;
	while (cin>>s)
	{
		int flg = 0;
		string ans;
		if (s.size()%2==1)		//?????????????\???°?????´???
		{
			cout << "NA" << endl;
		}
		else
		{
			for (int i = 0; i < s.size(); i += 2)
			{
				if ((s[i] >= '1') && (s[i] <= '6') && (s[i + 1] >= '1') && (s[i + 1] <= '5'))	//??¨???????????§????????´???
				{
					a = s[i] - '0'-1;
					b = s[i + 1] - '0'-1;
					flg = 1;
					ans += table[a][b];
				}
			}
			if (flg)
			{
				cout << ans <<endl;
			}
			else
			{
				cout << "NA" <<endl;		//1????????§???????????§???????????´???
			}
		}
	}

	return 0;
}