Program HOC24;
var s: string;
a: array[1..255] of string;
max,d,i: byte;
begin
write('Nhap xau: '); readln(s);
while s[1]=#32 do delete(s,1,1);
while s[length(s)]=#32 do delete(s,length(s),1);
while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);
s:=s+' '
while length(s)<>0 do
begin
d:=d+1;
a[d]:=copy(s,1,pos(#32,s));
delete(s,1,pos(#32,s));
end;
max:=length(a[1]);
for i:=2 to d do
if max<length(a[i]) then max:=length(a[i]);
for i:=1 to d do
if max = length(a[i]) then writeln(a[i]);
readln
end.
Program HOC24;
uses sysutils;
var s: string;
words: TStringDynArray;
max_length, i: integer;
longest_words: array of string;
begin
write('Nhap xau: ');
readln(s);
words := SplitString(s);
max_length := 0;
for i := Low(words) to High(words) do
if Length(words[i]) > max_length then
max_length := Length(words[i]);
SetLength(longest_words, 0);
for i := Low(words) to High(words) do
if Length(words[i]) = max_length then
begin
SetLength(longest_words, Length(longest_words) + 1);
longest_words[High(longest_words)] := words[i];
end;
writeln('Tu dai nhat trong xau là:');
for i := Low(longest_words) to High(longest_words) do
writeln(longest_words[i]);
end.