Uses Crt;
var
a,b,c,d,e,f,i: Integer;
stroka:string;
n:char;
begin
writeln('Введите текст:');
readln(stroka);
a:=0;
b:=0;
c:=0;
d:=0;
e:=0;
f:=0;
for i:=1 to length(stroka) do
begin
n:=stroka[i];
if n='(' then Inc(a);
if n=')' then Inc(b);
if n='{' then Inc(c);
if n='}' then Inc(d);
if n='[' then Inc(e);
if n=']' then Inc(f);
end;
if (a=b) and (c=d) and (e=f) then
writeln('скобки расставлены верно')
else
writeln('скобки расставлены неверно');
readln
end.