Ребят, скажите, что у меня не так. результат не такой какой нужен. как избавиться от смещения индексов. Вот программа:
Код
uses crt;
const delimiter = [#32, ',', '.', '!', ':'];
type wrd_info = record start, len: byte; end;
function get_words(s: string; var words: array of wrd_info): integer;
var
   count: integer;
   i, curr_len: byte;
begin
     count := -1; i := 1;
     while i <= length(s) do
     begin
           while (s[i] in delimiter) and (i <= length(s)) do inc(i);
           curr_len := 0;
           while not (s[i] in delimiter) and (i <= length(s)) do begin
           inc(i);
           inc(curr_len);
    end;
    if curr_len > 0 then
    begin
         inc(count);
         with words[count] do
         begin
              start := i - curr_len;
              len := curr_len
         end;
    end;
end;
    get_words := count + 1;
end;
const max_word = 255;
var words: array[1 .. max_word] of wrd_info;
    i, n: integer;
    s,p,h:string;
begin
     clrscr;
     Write('Vvedite glavnuu stroku');
     readln(s);
     Write('Vvedite podstroku');
     readln(h);
     n := get_words(s, words);
     for i := 1 to n do
     if pos(h, copy(s, words[i].start, words[i].len)) = 0 then
     begin
          delete(s,words[i].start, words[i].len);
          insert('[consored]', s,words[i].start);
     end;
     writeln(s);
end.