Lời giải :
program hotrotinhoc ;
var s: string;
begin
write('Nhap xau s :'); readln(s);
while s[1]=#32 do
delete(s,1,1);
while pos(#32#32,s) <>0 do
delete(s,pos(#32#32,s),1);
while s[length(s)]=#32 do
delete (s,length(s),1);
write(s);
readln
end.