Program Kursovik;
var
i, j, x, k, n : Integer;
a, b : array[0..999] of Char;
s: string;
begin
writeln('Введите строку: ');
readln(s);
i:=1; j:=1; k:=0; x:=0;
for x := 1 to length(s) do a[x] := s[x];
while not (i > x) do
begin
if not (a[i-1] in [#160.. #175, #224..#239]) then
if not (a[i-1] in [#48..#57]) then
if a[i] = 'р' then
if a[i+1] = 'а' then
if a[i+2] = 'к' then
if not (a[i+3] in [#160.. #175, #224..#239]) then
if not (a[i+3] in [#48..#57]) then
begin
b[j] := 'щ';
b[j+1] := 'у';
b[j+2] := 'к';
b[j+3] := 'а';
i := i + 3;
j := j + 4;
end
else begin b[j] := a[i]; i := i + 1; j := j + 1; end
else begin b[j] := a[i]; i := i + 1; j := j + 1; end
else begin b[j] := a[i]; i := i + 1; j := j + 1; end
else begin b[j] := a[i]; i := i + 1; j := j + 1; end
else begin b[j] := a[i]; i := i + 1; j := j + 1; end
else begin b[j] := a[i]; i := i + 1; j := j + 1; end
else begin b[j] := a[i]; i := i + 1; j := j + 1; end
end;
write('Результирующий массив:');
repeat
k := k + 1;
write(b[k]);
until k = j;
readln;
end.
Ограничения и тестовые примеры, а также описание алгоритма (всё тот рак) |