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<bits/stdc++.h>
using namespace std;
int main(){
	string a="abcdefghijklmnopqrstuvwxyz.?! ";
	string b;
	while(cin>>b){
		if(b.length()%2==1) {
			cout<<"NA"<<endl;
			goto stop;
		}
		string c;
		for(int i=0;i<b.length();i+=2){
			int c,d;
			c=(int)b[i]-'1';
			d=(int)b[i+1]-'0';
			int e=c*5+d;
			if(e>25) {
				cout<<"NA"<<endl;
				goto stop;
			}
			c+=a[e-1];
		}
		cout<<endl;
		stop:;
	}
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	string st;
	while (getline(cin,st)) {
		string ans;
		bool ok = true;
		if (st.size() % 2)ok = false;
		for (int i = 0; i < st.size() / 2; ++i) {
			string ast = st.substr(2 * i, 2);
			int num = (ast[0] - '1') * 5 + (ast[1] - '1');
			if (num <= 25)ans += 'a' + num;
			else if (num == 26)ans += '.';
			else if (num == 27)ans += '?';
			else if (num == 28)ans += '!';
			else if (num == 29)ans += " ";
			else {
				ok = false;
				break;
			}
		}
		if (ok) {
			cout << ans << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
	return 0;
}

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 {
			for (int i = 0; i < b.size(); i++) {
				int p = b[i] - '0';
				int q = b[i+1] - '0';
				cout << abc[5*(p-1)+q-1];
				i++;
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	char c[4] = {'.','?','!',' '};
	string S;
	while(cin>>S){
		string ans;
		if(S.size()%2!=0){
			puts("NA"); goto NEXT;
		}
		for(int i=0;i<S.size();i+=2){
			int a = S[i]-'0', b = S[i+1]-'0';
			if(!isdigit(S[i]) || !isdigit(S[i+1]) || a<1 || 6<a || b<1 || 5<b){
				puts("NA"); goto NEXT;
			}
			int n = (a-1)*5+(b-1);
			if(n<26) ans += ('a'+n);
			else if(n<30) ans += c[n-26];
			else{
				puts("NA"); goto NEXT;
			}
		}
		cout<<ans<<endl;
		NEXT:;
	}
	return 0;
}

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

using namespace std;

int main()
{
	char string[6][6],input[201];
	int i;
	for (i=0; i<26; i++) string[i/5][i%5]='a'+i;
	string[5][i++%5]='.',string[5][i++%5]='?';
	string[5][i++%5]='!',string[5][i++%5]=' ';
	while (scanf(" %s",input)!=EOF) {
		if (strlen(input)%2!=0) {
			cout<<"NA"<<endl;
			continue;
		}
		int i;
		for (i=0; i<strlen(input); i++) {
			if (i%2==0&&((input[i]-'0')<1||(input[i]-'0')>6)) {
				break;
			}
			if (i%2!=0&&((input[i]-'0')<1||(input[i]-'0')>5)) {
				break;
			}
		}
		if (i!=strlen(input)) {
			cout<<"NA"<<endl;
			continue;
		}
		
		for (int i=0; i<strlen(input); i+=2) {
			cout<<string[input[i]-1-'0'][input[i+1]-1-'0'];
		}
		cout<<endl;
	}
}

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

int charToInt(char c) {
  return (int)c - (int)'0';
}

int main() {
  string str;
  while(getline(cin, str)) {
    bool flag = false;
    stringstream sin;
    if(str.length() % 2 != 0) {
      flag = true;
    } else {
      for(int i = 0; i < str.length(); i += 2) {
	int num1 = charToInt(str[i]);
	int num2 = charToInt(str[i+1]);
	if(num1 < 1 || num1 > 6 || num2 < 1 || num2 > 5) {
	  flag = true;
	  break;
	}

	if(num1 == 6 && num2 >= 2) {
	  switch(num2) {
	  case 2: sin << '.'; break;
	  case 3: sin << '?'; break;
	  case 4: sin << '!'; break;
	  case 5: sin << ' '; break;
	  }
	} else {
	  sin << (char)(((num1-1) * 5 + num2-1) + (int)'a');
	}
      }
    }
    if(flag) {
      cout << "NA" << endl;
    } else {
      cout << sin.str() << endl;
    }
  }
  return 0;
}

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

int main(){
	char p[5][6] =
	{{'a','f','k','p','u','z'},
	 {'b','g','l','q','v','.'},
	 {'c','h','m','r','w','?'},
	 {'d','i','n','s','x','!'},
	 {'e','j','o','t','y',' '}};
	string a;	
	while(cin >> a){
		bool flag = false;
		for(size_t i=0;i<a.size();i+=2){
			if(a[i]>'6' || a[i]<'1')
				flag = true;
			if(a[i+1]>'5' || a[i]<'1')
				flag = true;
		}
		if(flag||a.size()%2){
			cout << "NA" << endl;
		}else{
			for(size_t i=0;i<a.size();i+=2){
				cout << p[a[i+1]-'0'-1][a[i]-'0'-1];
			}
			cout << endl;
		}
	}
}

C++: #include<stdio.h>
#include<string.h>
#include <sstream>
#include <cstdlib>
using namespace std;

int main(){

  char s[402],G[5][7]={'a','f','k','p','u','z','\0','b','g','l','q','v','.','\0','c','h','m','r','w','?','\0','d','i','n','s','x','!','\0','e','j','o','t','y','&','\0'};
  int i,j,temp,a,b,c;

  


  while(scanf("%s", s)!= EOF){
     temp = strlen(s);
     c=0;
     if(temp==0) continue;
     if(temp %2 == 0) {
       for(i=0;;i+=2){
	 if(s[i]=='\0' || s[i+1]=='\0') break;
	 if(s[i]-'0'<1 || s[i]-'0'>6) c=1;
	 if(s[i+1]-'0'<1 || s[i+1]-'0'>5) c=1;
       }
       if(c==1){
	 printf("NA\n");
	 continue;
       }
       for(i=0; i<temp; i+=2){
	 //a = atoi(s[i+1]);
	 //b = atoi(s[i]);
	 a=s[i+1]-'0';
	 b=s[i]-'0';
	 if(G[a-1][b-1] == '&') printf(" ");
	 else printf("%c",G[a-1][b-1]);
       }
     }else printf("NA");
     printf("\n");
  }
  return 0;
}