#!/usr/athena/bin/perl

use warnings;
use strict;

my $B = 644;
my $S = 69;
my $M = 102;

my $N = (scalar reverse $M) ** 2;
my $C = (scalar reverse $B) ** 2;
my $T = (scalar reverse $S) ** 2;

my $U = substr($T,0,2);

print ">>> $C $N $U\n";

my @digits = split //, ($C . $N . $U);
die "oops!" unless @digits == 13;

my @ADD = qw( 8 5 11 11 17 15 9 5 10 20 0 3 17 );

my @result = map $digits[$_]+$ADD[$_]-1, 0..12;

print ">>> @result\n";

my @decode = 'A' .. 'Z';

print @decode[@result], "\n";
