program Genpal; {determine if the first Length elements of array Pal are a palindrome} const MaxPal = 50; {max value for Length} type PalEltType = Char; {input type for palindrome} PalRange = 1..MaxPal; PalArray = array[PalRange] of PalEltType; var Pal : PalArray; {the palindrome holder} Length : Integer; {the length of the current test item} I : Integer; {counter} function PalTest( FPal : PalArray; FLen : Integer) : Boolean; {returns True if FPal contains a length FLen palindrome} var Pos, Chk : Integer; {current position and number of tests to make} begin PalTest := True; Chk := FLen div 2; for Pos := 1 to Chk do if FPal[Pos] <> FPal[Flen-Pos+1] then PalTest := False end;{PalTest} begin{main program} WriteLn('Input the length of CHARACTER string for Testing'); ReadLn(Length); WriteLn; WriteLn('Input a string of ',Length : 3,' CHARACTERS'); for I := 1 to Length do Read(Pal[I]); WriteLn; WriteLn; if PalTest(Pal,Length) then WriteLn('Palindrome found') else WriteLn('Not a palindrome') end.