pos('енок',s)
...
var F: Text;
...
Assign(F, 'name.txt);
ReSet(F);
...
While not EOF(F) do
begin
ReadLn(F, S);
...
end;
...
Close(F);
...
(s[i+1]=' ') or (i=n)
for i:=1 to n do begin
if (s[i+1]=' ') or (i=n) then begin
if (copy(s,i-3,4)='onok') or (copy(s,i-3,4)='enok') then
writeln (copy(s,nah,i-nah+1));
if s[i+2]<>' ' then nah:=i+2;
end;
end;
...
if (copy(StrUpper(s),i-3,4)=StrUpper('onok')) or (copy(StrUpper(s),i-3,4)=StrUpper('enok')) then
writeln (copy(s,nah,i-nah+1));
...