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() {
	string abc = "abcdefghijklmnopqrstuvwxyz.?! ";
	string b;
	while (cin >> b) {
		if (b.size() % 2 != 0) {
			cout << "NA" << endl;
		} else {
			string a = "";
			bool hantei = true;
			for (int i = 0; i < b.size(); i++) {
				int p = b[i] - '0';
				int q = b[i+1] - '0';
				if (p <= 0 || p > 6 || q <= 0 || q > 5) {
					hantei = false;
					break;
				}
				a += abc[5*(p-1)+q-1];
				i++;
			}
			if (hantei) {
				cout << a << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include<string>
#include <sstream>
using namespace std;

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
string str;
char mozi[66];
string d;
int e;
int use;
char i ='a';
bool flag;
int main()
{
  for(int j = 1; j <=6;j++){
    for(int l = 1;l <=5;l++){
      if(j ==6&&l >=2)
	break;
      mozi[j*10+l] =i++;
	 }
      }
    mozi[62] ='.';
    mozi[63] ='?';
    mozi[64] ='!';
    mozi[65] =' ';
  while(cin>>str){
    string ans;
    if(str.size()%2){
      cout <<"NA"<<endl;
    }else{
      flag = false;
      for(int i = 0;i <str.size();i+=2){
      d = str.substr(i, 2);
      e =toInt(d);
      ans +=mozi[e];
      if(e <11||e >65){
	flag = true;
	break;
      }
      }
      if(flag){
	cout <<"NA"<<endl;
      }else{
	cout <<ans<<endl;
      }
    }
    ans.clear();
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

char c[]={'z','.','?','!',' '};
string s;

int main(){
	while(getline(cin,s)){
		int l=s.size();
		if(l%2){cout<<"NA"<<endl;continue;}
		int cur=0,f=0;
		string ans="";
		while(cur<l){
			int a=s[cur++]-'0',b=s[cur++]-'0';
			if(a<1||a>6||b<1||b>5){cout<<"NA"<<endl;f=1;continue;}
			if(a<6)ans+=(char)('a'+(a-1)*5+b-1);
			if(a==6)ans+=c[b-1];
		}
		if(!f)cout<<ans<<endl;
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

string ans, s;
string table[] = {  "afkpuz", "bglqv.",
"chmrw?", "dinsx!", "ejoty " };

int main(){
	while (cin >> s){
		bool f = 0;
		ans = "";
		if (s.size() % 2 != 0){
			cout << "NA" << endl;
			continue;
		}
		if (s.size() == 0)cout << "NA" << endl;
		for (int i = 0; i < s.size(); i += 2){
			if (s[i]>'6' || s[i]<'1' || s[i + 1]>'6' || s[i] < '1'){
				f = 1;
				break;
			}
			ans += table[s[i + 1] - '1'][s[i] - '1'];
		}
		if (f)cout << "NA" << endl;
		else cout << ans << endl;
		ans.clear();
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(void){
	const char *table[] ={
		"afkpuz",
		"bglqv.",
		"chmrw?",
		"dinsx!",
		"ejoty "
	};

	while( true ){
		bool bNA = false;
		string s;

		cin >> s;

		if( cin.eof() )
			break;

		if( s.length() % 2 == 1 ){
			bNA = true;
			goto NA;
		}
		for(unsigned int l = 0; l < s.length(); l += 2){
			int i = s[l+1]-'0'-1;
			int j = s[l]-'0'-1;
			if( !(0 <= i && i <= 4) || !(0 <= j && j <= 5) ){
				bNA = true;
				goto NA;
			}
		}
NA:;
		if( bNA ){
			cout << "NA\n";
			continue;
		}

		for(unsigned int l = 0; l < s.length(); l += 2){
			int i = s[l+1]-'0'-1;
			int j = s[l]-'0'-1;
			cout << table[i][j];
		}
		cout << '\n';
	}

	return 0;
}

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

int main()
{
	string table[5] = { "afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty " };
	string s;
	int x,y;
	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'))	//??¨???????????§????????´???
				{
					y = s[i] - '0'-1;
					x = s[i + 1] - '0'-1;
					flg = 1;
					ans += table[x][y];
				}
			}
			if (flg)
			{
				cout << ans <<endl;
			}
			else
			{
				cout << "NA" <<endl;		//1????????§???????????§???????????´???
			}
		}
	}
	return 0;
}

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

int main() {
    string input;
    while (cin >> input) {
        if ((int) input.length() % 2 != 0) {
            cout << "NA" << endl;
            continue;
        }
        bool NAFlag = false;
        string output;
        while (input.length() > 0) {
            switch (input[0]) {
            case '1':
                output += 'a' + (input[1] - '0') - 1;
                break;
            case '2':
                output += 'f' + (input[1] - '0') - 1;
                break;
            case '3':
                output += 'k' + (input[1] - '0') - 1;
                break;
            case '4':
                output += 'p' + (input[1] - '0') - 1;
                break;
            case '5':
                output += 'u' + (input[1] - '0') - 1;
                break;
            case '6':
                switch (input[1]) {
                case '1':
                    output += 'z';
                    break;
                case '2':
                    output += '.';
                    break;
                case '3':
                    output += '?';
                    break;
                case '4':
                    output += '!';
                    break;
                case '5':
                    output += ' ';
                    break;
                default:
                    NAFlag = true;
                    break;
                }
                break;
            default:
                NAFlag = true;
                break;
            }
            if (NAFlag) {
                cout << "NA" << endl;
                continue;
            }
            input.erase(0, 2);
        }
        cout << output << endl;
    }
}