Loading...
Loading...
Loading...
A code editor checks that every opening bracket ( [ { has a matching closing bracket ) ] } in the right order. Print Yes if the text is balanced and No otherwise.
Example 1
Input
{[()]}Output
Yes
Properly nested.
Example 2
Input
([)]
Output
No
Try the problem first. Open one hint at a time.
A closing bracket must match the most recent opening bracket that is still open.
Push openers on a list; on a closer, pop and compare.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor