function IsPalindrome(const S : string) : boolean; var PA,PB : integer; begin PA := 1; PB := Length(S); result := PA <= PB; while (PA < PB) and Result do begin result := S[PA] = S[PB]; PA := PA + 1; PB := PB - 1; end; end;