Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///ТМП-15 | Задание 1
- var st, c_ans, w_ans, res: string;
- cnt, m, i: byte;
- begin
- st := readstring('string:');
- w_ans := 'abc';
- m := length(w_ans);
- while pos(w_ans, st) <> 0 do begin
- delete(st, pos(w_ans, st), m);
- cnt += 1;
- end;
- writeln('abc count: ', cnt);
- end.
- ///ТМП-15 | Задание 2
- var st, c_ans, w_ans, res: string;
- m, i: byte;
- begin
- st := readstring('string:');
- res := 'New string: ';
- w_ans := 'abc';
- c_ans := 'def';
- m := length(w_ans);
- while pos(w_ans, st) <> 0 do begin
- insert(c_ans, st, pos(w_ans, st));
- delete(st, pos(w_ans, st), m);
- end;
- writeln('-' * (length(st) + length(res)));
- writeln(res, st);
- end.
- ///ТМП-15 | Задание 4
- var st, c_ans, w_ans, res: string;
- m, i: byte;
- begin
- st := readstring('string:');
- res := 'New string: ';
- w_ans := 'she';
- c_ans := 'he';
- m := length(w_ans);
- while pos(w_ans, st) <> 0 do begin
- insert(c_ans, st, pos(w_ans, st));
- delete(st, pos(w_ans, st), m);
- end;
- writeln('-' * (length(st) + length(res)));
- writeln(res, st);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement