Posted on Leave a comment

Bracket sequence

()((())((())

Is it correct sequence?

I need just a counter.

foreach char in string {

If next bracket is “(” then inc(counter);

If next bracket is “)” then dec(counter);

If counter < 0 then showmessage(“Error”);

}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.