var s,s1,s2:string;
p,k:integer;
begin
writeln('Введите строку:');
readln(s);
s1:=s+' ';
while pos(' ',s1)>0 do delete(s1,pos(' ',s1),1);
while s1<>'' do
begin
p:=pos(' ',s1);
s2:=copy(s1,1,p-1);
delete(s1,1,p);
k:=1;
while pos(s2,s1)>0 do
begin
k:=k+1;
delete(s1,pos(s2,s1),p);
end;
if k=1 then writeln(s2);
end;
end.
Пример:
Введите строку:
to be or not to be
or
not