Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 bracketStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started