uses crt;
var st, buf, max : string;
function isPalind(st:string):boolean;
var i:integer;
begin
isPalind := true;
for i:=1 to Length(st) div 2 do if st[i]<>st[length(st)-i+1] then
begin
isPalind := false;
break;
end;
end;
begin
clrscr;
write('-> ');
readln(st);
max:='';
buf:='';
while pos(' ',st)>0 do
begin
buf := copy(st,1,pos(' ',st)-1);
if (buf <> '') and (isPalind(buf)) and (length(buf) > length(max)) then max := buf;
buf := '';
delete(st,1,pos(' ',st));
end;
if (st<>'') and (isPalind(st)) and (length(st) > length(max)) then max := st;
writeln('Палиндром наибольшей длины - ',max);
readln;
end.