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;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	string s;
	char ch[4] = {'.', '?', '!', ' '};
	while(cin >> s) {
		if(s.length()%2!=0) {
			cout << "NA" << endl;
			continue;
		}
		bool f = 0;
		rep(i,s.length()/2) {
			int x = s[2*i]-'0';
			if(x<1 || 6<x) {
				f=1; break;
			}
			int y = s[2*i+1]-'0';
			if(y<1 || 5<y) {
				f=1; break;
			}
			int ret = (x-1)*5+y; 
			if(ret<=26) cout << (char)('a'+ret-1);
			else cout << ch[ret-27];
		}
		if(f) cout << "NA";
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

const string table[] = {
	"abcde",
	"fghij",
	"klmno",
	"pqrst",
	"uvwxy",
	"z.?! ",
};

string solve( string src )
{
	if ( src.size() % 2 )
	{
		return "NA";
	}

	string res;

	for ( int i = 0; i < src.size(); i += 2 )
	{
		int idx1 = src[i] - '1', idx2 = src[ i + 1 ] - '1';
		if ( 6 <= idx1 || 5 <= idx2 )
		{
			return "NA";
		}
		res += table[ idx1 ][ idx2 ];
	}

	return res;
}

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

	string str;
	while ( cin >> str )
	{
		cout << solve( str ) << endl;
	}

	return 0;
}

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

int main(){
    char field[6][11];
    char a='a';
    for(int i=1; i < 7; i++){
        for(int j=1; j < 6; j++){
            field[j][i] = a;
            a++;
        }
    }
    field[2][6] = '.'; field[3][6] = '?'; field[4][6] = '!'; field[5][6] = ' ';

    string input;
    while(cin >> input){
        string ans;
        bool isCorrect = true;
        if(input.size()%2 == 1) {
            isCorrect = false;
            continue;
        }
        else {
            for(int i=0; i < input.size(); i+=2){
                int n = atoi(input.substr(i, 1).c_str());
                int m = atoi(input.substr(i+1, 1).c_str());
                if(!(1 <= m && m <= 5 && 1 <= n && n <= 6)) isCorrect = false;
                ans += field[m][n];
            }
        }
        if(isCorrect) cout << ans << endl;
        else cout << "NA" << endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <string>
class PocketBell {
public:
	std::string decode(const std::string &str) const {
		if (str.size() == 0) {
			return "";
		}
		else if ((str.size() & 1) == 1) {
			return "NA";
		}
		else {
			auto head = str.substr(0, 2);
			auto tail = decode(str.substr(2));
			if (tail == "NA" || !is_valid(head)) {
				return "NA";
			}
			else {
				return at(head) + tail;
			}
		}
	}
private:
	bool is_valid(const std::string &str) const {
		auto n = std::stoi(str);
		return (n / 10) > 0 && (n / 10) < 7 && (n % 10) > 0 && (n % 10) < 6;
	}
	char at(const std::string &str) const {
		auto n = std::stoi(str);
		return key.at((n / 10) * 5 + n % 10 - 6);
	}
	static const std::vector<char> key;
};
const std::vector<char> PocketBell::key{ '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() {
	PocketBell bell;
	for (std::string str; std::cin >> str;) {
		std::cout << bell.decode(str) << std::endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  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','.','?','!',' '}};
  string s;
  while(cin>>s){
    string ans="";
    if(s.size()%2==0){for(int i=0;i<s.size();i+=2)ans+=c[s[i]-'0'-1][s[i+1]-'0'-1];
    cout<<ans<<endl;}
    else cout<<"NA"<<endl;
  }
}

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

string tbl = "abcdefghijklmnopqrstuvwxyz.?! ";

int main() {
    string s;
    while (cin >> s) {
        int n = s.size();
        if (n % 2 == 1) {
            cout << "NA" << endl;
        } else {
            string ans = "";
            for (int i=0; i+1<n; i+=2) {
                int a = s[i] - '0';
                int b = s[i+1] - '0';
                if (1 <= a && a <= 6 && 1 <= b && b <= 5) {
                    ans = ans + tbl[(a-1) * 5 + (b-1)];
                } else {
                    ans = "NA";
                    break;
                }
            }
            cout << ans << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  string nums,text,ch;
  ch = "abcdefghijklmnopqrstuvwxyz.?! ";
  while(cin>>nums){
    text = "";
    if(nums.size()%2){
      cout<<"NA"<<endl;
    }
    else{
      for(int i=0;i<nums.size()/2;i++){
	if('0'<nums[i*2]&&nums[i*2]<'7'&&'0'<nums[i*2+1]&&nums[i*2+1]<'6')
	  text=text+ch[5*(nums[i*2]-49)+(nums[i*2+1]-49)];
	else{
	  text="NA";
	  break;
	}
      }
      cout<<text<<endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#define buf 10000
using namespace std;

int main(void){
  int i,n,m,len;
  char str[buf];

  for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
    len=strlen(str)-1;
    for(i=0;i<len;i+=2){
      if(len%2!=0){
        printf("NA");
        break;}
      n=(str[i]-'0')%48-1;
      m=(str[i+1]-'0')%48-1;
      if(n==5 && m==1)
        printf(".");
      else if(n==5 && m==2)
        printf("?");      
      else if(n==5 && m==3)
        printf("!");
      else if(n==5 && m==3)
        printf(" ");
      else
        printf("%c",'a'+n*5+m);
    }
    printf("\n");
  }
  return 0;
}