Valid Parentheses

Practice this coding question on Coding Gurukul.

Problem statement

A template uses round, square, and curly bracket pairs to group sections. Every closing bracket must match the most recent opening bracket that has not yet been closed. Determine whether the full template is properly nested with no unmatched brackets.

Input format

One nonempty string containing only ()[]{}.

Output format

Print true or false in lowercase.

Constraints

1 <= string length <= 100000.

Sample input

{[()]}[]

Sample output

true

Sign in to run or submit a solution in C++, Java or Python.