#C2111. Valid Parenthesis Expression

    ID: 45392 Type: Default 1000ms 256MiB

Valid Parenthesis Expression

Valid Parenthesis Expression

Given a string s consisting of characters ('), ('{', ('[' and their corresponding closing brackets, determine if the input string is a valid parenthesis expression.

An expression is considered valid if:

  1. Every opening bracket has a corresponding closing bracket of the same type.
  2. Brackets are closed in the correct order.
  3. An empty string is also considered valid.

For example, the mapping is given by \(\{')':'(', ']':'[', '}':'{'\}\). Use this mapping to validate the expression.

inputFormat

The input is provided via standard input (stdin) as a single line containing the string s with no spaces. The string only consists of the characters '(', ')', '{', '}', '[' and ']'.

outputFormat

Output via standard output (stdout) a single line with either "True" if the string is a valid parenthesis expression, or "False" if it is not valid.

## sample
()[]{}
True