Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program lab22;
- begin
- readln(s);
- q := 0;
- for i := 1 to length(s) do
- begin
- if s[i] = '(' then
- q := q + 1;
- if s[i] = ')' then
- begin
- if q = 0 then
- begin
- writeln('Incorrect');
- readln;
- halt;
- end else q := q - 1;
- end;
- end;
- if q = 0 then writeln('Correct')
- else writeln('Incorrect');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement