#!/usr/bin/perl -w
# Palindrome
#    VERSION: 1 (11 June 2004)
#    PURPOSE: Determine whether a sequence is a palindrome
#             Does so by examining the string character by character
#                from each end
#    INPUT FILES: None
#    OUTPUT FILES: None

############## LIBRARIES AND PRAGMAS ################

  use strict;

#################### CONSTANTS #######################

  my $LF = "\n";
  my $tab = "\t";
  my $true = 1;
  my $false = 0;

#################### VARIABLES ######################

  my $sequence;          # input sequence
  my $index;             # position of letter in sequence

###################### FILES ########################

################### MAIN PROGRAM ####################

  $sequence = <STDIN>;
  chomp $sequence;       # Removes line feed from end of line
  
  foreach $index (0 .. (length($sequence) - 1)) {
     my $letter1 = substr($sequence, $index, 1);
     my $letter2 = substr($sequence, -($index+1), 1);
     print $letter1, " ", $letter2, $LF;
     if (not Complementary ($letter1, $letter2)) {
        print "NOT a palindrome";
        die;}
     }
  print "A palindrome";

#################### SUBROUTINES ####################

#### COMPLEMENTARY (letter 1, letter 2)
#    Determines whether one letter is complementary to another
#    Returns true if it is, false if it isn't
sub Complementary {

   [fill in]
}



