There is a line (s), in it there are words through a space. It is necessary to put all the words in the array. And count how many times it occurs in a given string (s). I put it in an array.
lastid:=1; j:=1; for i:=1 to length(s) do if (s[i]=' ') then begin a[j]:=copy(s,lastid,i-lastid); lastid:=i+1; inc(j); end; a[j]:=copy(s,lastid,length(s)-lastid+1);