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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!