#K56232. Valid Brackets

    ID: 30153 Type: Default 1000ms 256MiB

Valid Brackets

Valid Brackets

Given a string consisting solely of the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

  • Every opening bracket has a corresponding closing bracket of the same type.
  • Brackets are closed in the correct order.

Note: An empty string is considered valid.

The challenge is to implement a solution that reads the input from standard input and writes the result to standard output.

inputFormat

The input consists of a single line containing a string made up of the characters '(', ')', '{', '}', '[' and ']'.

outputFormat

Output a single line: True if the string is valid (all brackets are properly closed and nested), or False otherwise.

## sample
()
True