S1L1R

Untitled

Nov 25th, 2020
416
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///ТМП-15 | Задание 1
  2. var st, c_ans, w_ans, res: string;
  3.     cnt, m, i: byte;
  4.    
  5. begin
  6.    st := readstring('string:');
  7.    w_ans := 'abc';
  8.    
  9.    m := length(w_ans);
  10.    while pos(w_ans, st) <> 0 do begin
  11.         delete(st, pos(w_ans, st), m);
  12.         cnt += 1;
  13.    end;
  14.    
  15.    writeln('abc count: ', cnt);
  16. end.
  17.  
  18. ///ТМП-15 | Задание 2
  19. var st, c_ans, w_ans, res: string;
  20.     m, i: byte;
  21.    
  22. begin
  23.    st := readstring('string:');
  24.    res := 'New string: ';
  25.    
  26.    w_ans := 'abc';
  27.    c_ans := 'def';
  28.    
  29.    m := length(w_ans);
  30.    while pos(w_ans, st) <> 0 do begin
  31.         insert(c_ans, st, pos(w_ans, st));
  32.         delete(st, pos(w_ans, st), m);
  33.    end;
  34.    
  35.    writeln('-' * (length(st) + length(res)));
  36.    writeln(res, st);
  37. end.
  38.  
  39. ///ТМП-15 | Задание 4
  40. var st, c_ans, w_ans, res: string;
  41.     m, i: byte;
  42.    
  43. begin
  44.    st := readstring('string:');
  45.    res := 'New string: ';
  46.    
  47.    w_ans := 'she';
  48.    c_ans := 'he';
  49.    
  50.    m := length(w_ans);
  51.    while pos(w_ans, st) <> 0 do begin
  52.         insert(c_ans, st, pos(w_ans, st));
  53.         delete(st, pos(w_ans, st), m);
  54.    end;
  55.    
  56.    writeln('-' * (length(st) + length(res)));
  57.    writeln(res, st);
  58. end.
RAW Paste Data