#C9444. Bracket Sequence Validator

    ID: 53538 Type: Default 1000ms 256MiB

Bracket Sequence Validator

Bracket Sequence Validator

In this problem, you are given a string consisting solely of the characters '(', ')', '{', '}', '[' and ']', as well as possible spaces. Your task is to determine whether the given string is a valid bracket sequence.

A valid bracket sequence follows these rules:
1. Every opening bracket must have a corresponding closing bracket of the same type.
2. Opening brackets must be closed in the correct order.

The solution should read the input from standard input (stdin) and output the result to standard output (stdout) as either the string True or False.

inputFormat

The input consists of a single line containing a sequence of bracket characters and possibly spaces. An empty input (i.e., an empty string) is also valid.

outputFormat

Output a single line containing either True if the sequence is valid according to the rules or False if it is not.## sample

( [ { } ] )
True