An easier to implement alternative is:
A string of length zero or one is a palindrome. Anything longer must
have the first and last letter the same, and the in-between letters
must be a palindrome.
So again avoiding the issue of punctuation and spaces,
function Is_Palindrome (S : String) return Boolean is
begin
return S'Length <= 1 or else
Is_Palindrome (S(Natural'Succ(S'First) ..
Natural'Pred(S'Last))));
end Is_Palindrome;
regards
Bill Taylor ([log in to unmask])
-----Original Message-----
From: Team Ada: Ada Advocacy Issues (83 & 95)
[mailto:[log in to unmask]]On Behalf Of Tom Moran
Sent: 19 April 2000 18:00
To: [log in to unmask]
Subject: Re: [Off topic] palindromes
The middle of a palindrome is also a palindrome, so one definition is:
A zero length string is a palindrome. Anything longer must
have the first and last letter the same, and the in-between letters
must be a palindrome.