program PalindromeString; var str, reverseStr: string; i: integer; begin write('Enter a string: '); readln(str);
// Remove spaces from the string for i := 1 to Length(str) do begin if str[i] <> ' ' then reverseStr := reverseStr + str[i]; end;
// Check if the string is a palindrome for i := 1 to Length(reverseStr) div 2 do begin if reverseStr[i] <> reverseStr[Length(reverseStr) - i + 1] then begin writeln('The string is not a palindrome.'); exit; end; end;
program PalindromeString;
var
str, reverseStr: string;
i: integer;
begin
write('Enter a string: ');
readln(str);
// Remove spaces from the string
for i := 1 to Length(str) do
begin
if str[i] <> ' ' then
reverseStr := reverseStr + str[i];
end;
// Check if the string is a palindrome
for i := 1 to Length(reverseStr) div 2 do
begin
if reverseStr[i] <> reverseStr[Length(reverseStr) - i + 1] then
begin
writeln('The string is not a palindrome.');
exit;
end;
end;
writeln('The string is a palindrome.');
end.