#!/usr/bin/perl -w
# Palindrome
#    VERSION: 1 (11 June 2004)
#    PURPOSE: Determine whether a sequence is a palindrome
#    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 @letters;           # component letters of sequence
  my @opposite_letters;  # same letters, opposite order
  my $index;             # position of letter in sequence

###################### FILES ########################

################### MAIN PROGRAM ####################

  $sequence = <STDIN>;
  chomp $sequence;       # Removes line feed from end of line
  @letters = split ("", $sequence);
  @opposite_letters = reverse (@letters);
  
  foreach $index (0 .. (length(@letters) - 1)) {
     my $letter1 = $letters[$index];
     my $letter2 = $opposite_letters[$index];
     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]
}



