#K73152. Valid Nested Bracket Expressions

    ID: 33912 Type: Default 1000ms 256MiB

Valid Nested Bracket Expressions

Valid Nested Bracket Expressions

You are given a string representing an expression containing only three types of brackets: ('), {'}, and [']. An expression is considered valid if every opening bracket is closed by the same type of bracket in the correct order. The empty string is also considered valid.

For example, the expression ({[]}) is valid, while ({[)]} is not valid.

Your task is to determine whether the input string is a valid nested expression. Use an efficient algorithm (such as a stack-based method) to solve the problem.

inputFormat

The input consists of a single line containing a string of brackets. The string may be empty.

outputFormat

Output a single line: True if the expression is valid, or False otherwise.

## sample
({[]})
True