#C14297. Valid Parentheses
Valid Parentheses
Valid Parentheses
Given a string consisting solely of the characters '(', ')', '{', '}', '[' and ']', determine whether the string is valid.
A string is considered valid if:
- Every opening bracket has a corresponding closing bracket.
- The brackets are closed in the correct order.
An empty string is also considered valid.
For example:
()
is valid.()[]{}
is valid.(]
is not valid.[([]])
is not valid.({[({[]{}})]})
is valid.
inputFormat
A single line containing a string composed solely of the characters '(', ')', '{', '}', '[' and ']'. The input is read from standard input (stdin).
outputFormat
Output a single line to standard output (stdout) containing either 'True' or 'False', indicating whether the input string is valid.## sample
True