96 of 100 menu

PHP Taskbook Level 10.6

Make a script that generates quadratic equations with integer roots.

Given a string containing any number of nested paired parentheses, write code that will check that the parentheses are positioned correctly.

This is correct:

'()()'

This is correct:

'(())'

This is incorrect, since the number of open brackets does not match the number of closed ones:

'())'

This is incorrect, because although the number of open brackets matches the number of closed ones, they are in the wrong order:

'))(('
hibybnuzcaz