Go: package main

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

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>
#include <cstring>
using namespace std;

char getGlyph( int col, int row )
{
	if( col < 1 || col > 6 || row < 1 || row > 5 ){
		return '\0';
	}
	char glyph = '\0';
	if( col < 6 ){
		glyph = 'a' + ( col - 1 ) * 5 + ( row - 1 );
	}else{
		const char sign[] = { 'z', '.', '?', '!', ' ' };
		glyph = sign[ row - 1 ];
	}
	return glyph;
}

int main()
{
	char input[ 201 ];
	while( cin >> input ){
		bool failed = false;
		int len = strlen( input );
		int reader = 0;

		char output[ 201 ];
		int writer = 0;

		while( reader < len ){
			int col = input[ reader++ ] - '0';
			if( reader >= len ){
				failed = true;
				break;
			}
			int row = input[ reader++ ] - '0';
			char glyph = getGlyph( col, row );
			if( glyph == '\0' ){
				failed = true;
				break;
			}
			 output[ writer++ ] = glyph;
		}
		if( failed == true ){
			cout << "NA" << endl;
		}else{
			output[ writer ] = '\0';
			cout << output << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
main(){
char g[42]={97,102,107,112,117,122,98,103,108,113,118,146,99,104,109,114,119,63,100,105,110,115,120,33,101,106,111,116,121,32};
string s,a;
while(cin>>s,!cin.eof()){
a="";
for(int i=0;i<s.size();i+=2){
int l=s[i]-'0',r=s[i+1]-'0';
if(s.size()%2||l<1||r<1||l>6||r>5){a="NA";break;}
a+=g[r*6+l-7];
}
cout<<a<<endl;
}	
}

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

int main() {
	string a;
	while (cin >> a) {
		cout << a.length() << endl;
		if (a.length() % 2 == 1) { cout << "NA" << endl; continue; }
		string t = "";
		bool p =true;
		for (int b = 0; b < a.length(); b += 2) {
			if (a[b] > '6' || a[b]<'1' || a[b + 1]>'5' || a[b + 1] < '1') { cout << "NA" << endl; p = false; break; }
			int s = (a[b] - 49) * 5 + (a[b + 1] - 49) + 97;
			if (s < 123)t += (char)s;
			else {
				switch (s) {
				case 123:t += '.'; break;
				case 124:t += '?'; break;
				case 125:t += '!'; break;
				case 126:t += ' '; break;
				}
			}
		}
		if (p)cout << t << endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	const char r[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 str;
		bool b = true;
		if (s.size() % 2 == 1) { b = false; }
		else for (int i = 0; i < s.size(); i += 2) {
			int a, bc;
			a = s[i] - '0';
			bc = s[i + 1] - '0';
			if (a >= 7 || bc >= 6){
				b = false;
			}
			else str += r[a - 1][bc - 1];
		}
		if (b){
			cout << str << endl;
		}
		else cout << "NA" << endl;
	}
}

C++: /*****include*****/
#include <iostream>
#include <string>
/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****変数置き場*****/
	string number;
	string num;
	char c_x;
	char c_y;
	int x;
	int y;
	bool fail;
	char table[6][7] = {
		{'0','0','0','0','0','0','0'},
		{'0','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',' '}
	};
	string answer;
	/*****処理部*****/
	while(1){
		cin >> number;
		if(cin.eof())	break;
		fail = false;
		answer = "";
		if(number.length()%2 != 0){
			fail = true;
		}else{
			for(int i=0;i<number.length();i+=2){
				num = number.substr(i,2);
				c_x = num[0];
				c_y = num[1];
				x = c_x - '0';
				y = c_y - '0';
				if(x<=0 || x>6 || y<=0 || y>5){
					fail = true;
					break;
				}
				answer.append(1,table[y][x]);
				//cout << table[y][x];
			}
		}
		if(fail)	cout << "NA" << endl;
		else
			cout << answer << endl;
	}
	/*****処理終了後*****/
	return 0;
}

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

int main(){
	string a;
while(cin>>a){
	if(a.length()%2){cout<<"NA"<<endl;continue;}
	for(int b=0;b<a.length();b+=2){
		if(a[b]<49||a[b]>54||a[b+1]<49||a[b+1]>53){cout<<"NA"<<endl;continue;}
		int s=(a[b]-49)*5+(a[b+1]-49);
	if(s+97<='z')	cout<<(char)(s+97);
	else{
		switch(s){
			case ('z'+1):cout<<'.';break;
			case ('z'+2):cout<<'?';break;
			case ('z'+3):cout<<'!';break;
			case ('z'+4):cout<<' ';break;
			}
		}
		}
		cout<<endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
 char a[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 b;
 while (cin >> b) {
  string c = "";
  if (b.length() % 2 == 1) {
   cout << "NA" << endl;
   goto stop;
  }
  int h, w;
  for (int i = 0; i < b.length() ; ) {
   h = (int)b[i++] - '0';
   w = (int)b[i++] - '0';
   if (h > 6 || w > 5||h<0||w<0) {
    cout << "NA" << endl;
    goto stop;
   }
   h--; w--;
   c += a[h][w];
   h = 0; w = 0;
  }
  cout << c << endl;
  stop:;
 }
}

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)
	{
		if (cin.eof()) break;
		int flg = 0;
		string ans;
		if (s.size()%2)		//?????????????\???°?????´???
		{
			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;
}

C++: //Name: Pocket Pager Input
//Level: 1
//Category: 文字列
//Note: 

/**
 * 表を引くだけ。
 *
 * オーダーは O(|S|)。
 */
#include <iostream>
#include <string>

using namespace std;

bool solve(bool first) {
    static const char tbl[6][6] = {
        "abcde",
        "fghij",
        "klmno",
        "pqrst",
        "uvwxy",
        "z.?! "
    };

    string line;
    if(!getline(cin, line)) return false;
    if(line.size() % 2 == 1) {
        cout << "NA" << endl;
        return true;
    }
    string buf;
    for(int i = 0; i < line.size(); i += 2) {
        const int r = line[i] - '0' - 1;
        const int c = line[i+1] - '0' - 1;
        if(r < 0 || r >= 6 || c < 0 || c >= 5) {
            cout << "NA" << endl;
            return true;
        }
        buf += tbl[r][c];
    }
    cout << buf << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}