Надеюсь на вашу ! написать программу на языке pasсal, меняющую все слова "red" на "black", "tree" на "palms" из текста, указанного в файле in.txt и сохраняющую результат в файл out.txt. все остальные слова, пробелы, запятые, точки и т.п должны остаться без изменений. вот сам текст: a red black tree is a binary search tree where each node has a color attribute the value of which is either red or black in addition to the ordinary requirements imposed on binary search trees the following requirements apply to red black trees. a node is either red or black the root is black this rule is sometimes omitted from other definitions. since the root can always be changed from red to black but not necessarily vice versa this rule has little effect on analysis. all leaves are the same color as the root both children of every red node are black. every simple path from a given node to any of its descendant leaves contains the same number of black, black, black, very "black" nodes.
ind: integer;
currentString: string;
begin
assign(myInFile, 'in.txt');
reset(myInFile);
assign(myOutFile, 'out.txt');
rewrite(myOutFile);
while (not EOF(myInFile)) do
begin
currentString := readln(myInFile);
while (pos('red', currentString) > 0) do
begin
ind := pos(currentString, 'red');
delete(currentString, ind, length('red'));
insert('black', currentString, ind);
end;
while (pos('tree', currentString) > 0) do
begin
ind := pos(currentString, 'tree');
delete(currentString, ind, length('tree'));
insert('palms', currentString, ind);
end;
end;
close(myInFile);
close(myOutFile);
end.