#C4759. Well-Formed Bracket String Checker

    ID: 48332 Type: Default 1000ms 256MiB

Well-Formed Bracket String Checker

Well-Formed Bracket String Checker

Given a string s composed solely of the characters '(', ')', '{', '}', '[' and ']', determine if the string is well-formed. A string is considered well-formed if every opening bracket has a corresponding closing bracket in the correct order. More formally, if you denote by \(s[i]\) an opening bracket, then there must exist an index \(j > i\) such that \(s[j]\) is the matching closing bracket and the substring between \(s[i]\) and \(s[j]\) is also well-formed. Use a stack to verify the correctness of the bracket sequence.

inputFormat

The input is given as a single line from standard input (stdin). The line contains a string s consisting only of the characters '(', ')', '{', '}', '[' and ']'.

outputFormat

Print to standard output (stdout) a single line: True if the string is well-formed, or False otherwise.

## sample
()
True