Enter an expression that ends with the enter key. determine if the parentheses are correctly placed. PASCAL

program zz1;

var
s: string; // set a variable of string type
i, m1, n1, n2: integer; // set a variable of integer type

begin
write (‘enter expression’);
read (s); // enter a string from the keyboard
n1: = pos (‘(‘, s); // check which parenthesis is earlier
n2: = pos (‘)’, s);
if n2> n1 then
for i: = 1 to length (s) do // organize a loop in which we iterate over all characters from the first to the last
begin
if s [i] = ‘(‘ then inc (m1); // increment the variable if we encounter one parenthesis
if s [i] = ‘)’ then dec (m1); // decrement the variable if we encounter another parenthesis
end
else m1: = 1;
if m1 = 0 then write (‘brackets are correct’)
else write (‘brackets are not placed correctly’);
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.