Question: Consider strings constructed using only the following characters (, ), [, and ]. Character ( matches with only ) and [ matches with only ].
Consider strings constructed using only the following characters ‘(‘, ‘)’, ‘[’, and ‘]’. Character ‘(’ matches with only ‘)’ and ‘[’ matches with only ‘]’. A string comprising of these characters is complete if every character is followed by its matching character or a substring that is complete followed by its matching character. For example “()”, “[]”, “([])”, “[]([]())” are all examples of complete strings, while “([)]” and “[][(])” are examples of incomplete strings. Write program using character stack which accepts such strings as input and prints “Complete” or “Incomplete”.
Step by Step Solution
3.44 Rating (170 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
