#K57697. Valid Parentheses Checker

    ID: 30478 Type: Default 1000ms 256MiB

Valid Parentheses Checker

Valid Parentheses Checker

You are given a string consisting solely of the characters '(', ')', '{', '}', '[' and ']'. Your task is to determine whether the sequence of parentheses is valid. A sequence is considered valid if every opening bracket has a corresponding closing bracket and the pairs are properly nested. In other words, if you process the string from left to right and use a stack data structure, the string is valid if the stack is empty at the end. This can be formally expressed as: if for each opening bracket there exists a matching closing bracket such that \(\text{stack} = 0\) at the end, the string is valid.

inputFormat

The input consists of a single line containing a string \(s\) that includes only the characters '(', ')', '{', '}', '[' and ']'.

outputFormat

Output a single line containing either True if the string's parentheses are valid, or False if they are not.

## sample
()
True

</p>