Balanced Brackets (Stacks)
Read a line of ()[]{} characters. Print balanced if every bracket closes in the right order, else unbalanced.
Input: One line (may be empty).
Output: balanced or unbalanced.
Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- Push opening brackets on a stack; pop and compare on closing ones.