i: = pos ('(' , s1);
j: = pos ('^' , s1);
k: = pos (')' , s1);
if i = j +1 then
if ((s1 [j - 1] = c2) or (s1 [j < span align = "justify"> - 1] = ',') or (j = 1)) and
((s1 [k +1] = c2) or (s1 [k +1] = ',') or (k = length (s1))) then
begin
DeMorgan (s1);
continue;
end;
if (i <> j +1) and (j 0) then
begin
s1 [j]: = '-';
continue;
end;
if (i = j +1) then
begin
sp: = copy (s1, j, k-i +2);
delete (s1, j, 1);
delete (s1, i, ki - 1);
DeMorgan (sp);
insert (sp, s1 , i);
end;
if i> 0 then s1: = dis (s1);
until pos ('(' , s1) = 0;
end;
if pos ('(' , s1)> 0 then Disp;
zamena;;
{ ********************************* *****************************}
{ Процедура інверсії формули (рядки) s1}
Procedure inversia;
var i , j, k: byte;
s: string;
Procedure proverka; s: ^ string;: = pos ('(', s1); j: = pos (')' , s1);
while i <> 0 do
begin
s ^: = copy (s1, i +1 , j - 1 - i);
if (((i = 1) or (s1 [i - 1] = '+')) and (s1 [i - 1] <> '^'))