Given a string A, containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. Return 0 / 1 ( 0 for false, 1 for true ) for this problem. Note: The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
Problem Constraints
1 <= |A| <= 106
Input Format
The first and only argument is a string A.
Output Format
Return an integer, 0 / 1 ( 0 for false, 1 for true )
Example Input
Input 1:
A = "()[]{}"
Input 2:
A = "([)]"
Example Output
Output 1:
1
Output 1:
0
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified.
Still have a question? Checkout Sample Codes for more details.