Блок-схема
program zadacha_1;
Uses CRT;
var i,jn,j:byte;
s:string;
Begin
write('Vvedite stroky: ');readln(s);
i:=0;
While i<Length(s) do
Begin
inc(i);
if s='(' then jn:=i;
if s=')' then
Begin
Delete (s,jn,i-jn+1);
For j:=i downto 1 do
if s[j]='(' then break;
if s[j]=')' then jn:=j;
dec(i,i-jn+1);
End;
End;
writeln('Polychennaja stroka: ',s);
readln;
End.
program zadacha_1;
Uses CRT;
var i,jn,j:byte;
s:string;
Begin
write('Vvedite stroky: ');readln(s);
i:=0;
While i<Length(s) do
Begin
inc(i);
if s='(' then jn:=i;
if s=')' then
Begin
Delete (s,jn,i-jn+1);
For j:=i downto 1 do
if s[j]='(' then break;
if s[j]=')' then jn:=j;
dec(i,i-jn+1);
End;
End;
writeln('Polychennaja stroka: ',s);
readln;
End.