var
a, b: string;
i, j: byte;
c: array [1 .. 100] of string;
function Polin(a: string): boolean;
var
i, j: byte;
begin
j := length(a);
for i := 1 to length(a) do
begin
if a[j] <> a[i] then
break;
dec(j)
end;
if i = length(a) then
Polin := true
else
Polin := false;
end;
begin
write('Vvedite tekst: ');
readln(a);
for i := 1 to length(a) do
begin
if not(a[i] in [' ', '.', ',', ';', '!', '?']) then
b := b + a[i];
if (a[i] in [' ', '.', ',', ';', '!', '?']) or (i = length(a)) then
begin
if b <> '' then
if Polin(b) then
begin
inc(j);
c[j] := b
end;
b := ''
end;
end;
b := c[1];
for i := 2 to j do
if length(b) < length(c[i]) then
b := c[i];
write('Naibolshiy palindrom v tekste eto ', b);
readln
end.