Question: C++ Syntax Checker Tom is facing a problem that he is using Notepad to code. And now, he wants to confirm that there are no
C++


Syntax Checker Tom is facing a problem that he is using Notepad to code. And now, he wants to confirm that there are no errors in the usage of brackets in his code. Your task is to help Tom to check if there is an error in the usage of brackets where opening brackets are and (, and the corresponding closing brackets are ] and ). The code can contain any brackets from the set [ 00 Input The input contains multiple test cases. Each test case contains a string S in one line which consists of characters whose ASCII codes range from 32 to 126 (In other words, there will be blank space in S). It is guaranteed that the length of S is in the range from 1 to 100000. Output Print "Success" if all the brackets are matched. Otherwise, print the position where the first unmatched closing bracket is found, and if there are no unmatched closing bracket, print the position of the first unmatched opening bracket. Syntax Checker Tom is facing a problem that he is using Notepad to code. And now, he wants to confirm that there are no errors in the usage of brackets in his code. Your task is to help Tom to check if there is an error in the usage of brackets where opening brackets are and (, and the corresponding closing brackets are ] and ). The code can contain any brackets from the set [ 00 Input The input contains multiple test cases. Each test case contains a string S in one line which consists of characters whose ASCII codes range from 32 to 126 (In other words, there will be blank space in S). It is guaranteed that the length of S is in the range from 1 to 100000. Output Print "Success" if all the brackets are matched. Otherwise, print the position where the first unmatched closing bracket is found, and if there are no unmatched closing bracket, print the position of the first unmatched opening bracket
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
