#!/usr/bin/perl -w
use strict;
my %next;
BEGIN {
@next{'0'..'9','A'..'Z'}= ('1'..'9','A'..'Z','0');
}
sub inc36 {
my $add= "";
my $dig;
while( not $dig= $next{chop($_[0])} ) {
$add .= $dig;
if( ! length($_[0]) ) {
$dig= '1';
last;
}
}
$_[0] .= $dig . $add;
}
while( <DATA> ) {
for( split " " ) {
print "$_ + 1 = ";
inc36( $_ );
print $_,$/;
}
}