Răspuns :
var
s:string;
i,n,j,max:integer;
t:text;
begin
assign(t,'fisier.in');
reset(t);
read(t,s);
close(t);
max:=1;
for i:=1 to length(s) do //gasim lungimea maximala
begin
if i=length(s) then //daca cuvintul e ultimul in enunt
if (i-j)>max then max:=i-j;
if s[i]=' ' then //daca cuvintul nu e ultimul in enunt
begin
if (i-j-1)>max then max:=i-j-1;
j:=i;
end;
end;
for i:=1 to length(s) do //gasim ce cuvint are lungimea gasita
begin
if i=length(s) then //daca cuvintul gasit e ultimul
if (i-j)=max then
for n:=j+1 to i do
write(s[n]);
if s[i]=' ' then //daca cuvintul nu e ultimul
begin
if (i-j-1)=max then
for n:=j+1 to i do
write(s[n]);
j:=i;
end;
end;
end.
s:string;
i,n,j,max:integer;
t:text;
begin
assign(t,'fisier.in');
reset(t);
read(t,s);
close(t);
max:=1;
for i:=1 to length(s) do //gasim lungimea maximala
begin
if i=length(s) then //daca cuvintul e ultimul in enunt
if (i-j)>max then max:=i-j;
if s[i]=' ' then //daca cuvintul nu e ultimul in enunt
begin
if (i-j-1)>max then max:=i-j-1;
j:=i;
end;
end;
for i:=1 to length(s) do //gasim ce cuvint are lungimea gasita
begin
if i=length(s) then //daca cuvintul gasit e ultimul
if (i-j)=max then
for n:=j+1 to i do
write(s[n]);
if s[i]=' ' then //daca cuvintul nu e ultimul
begin
if (i-j-1)=max then
for n:=j+1 to i do
write(s[n]);
j:=i;
end;
end;
end.