Question: 1. In this question, say that a string is well-balanced if the following three conditions are satisfied * Every left parenthesis character (' has a

1. In this question, say that a string is well-balanced if the following three conditions are satisfied * Every left parenthesis character (' has a corresponding right parenthesis character '), some- where to its right, and every left square bracket character '' has a corresponding right square bracket character' somewhere to its right. Each C,)', and ' belongs to exactly one pair of corresponding characters. E.g., (O] is not well-balanced. . For any two such pairs of corresponding characters, the two intervals in the string that they cover are either disjoint or one is contained within the other. E.g., [) is not well-balanced. For any pair of corresponding 'C- and-characters, the smallest enclosing pair of corre- sponding characters (if any) is of type'CSimilarly, for any pair of corresponding and 1-characters, the smallest enclosing pair of corresponding characters (if any) is of type E.g., [) is not well-balanced. For example, the string O O 0) is well-balanced and (otocCo])) is also well-balanced. Write a C program that asks the user to input a string and te determines whether or not the string is well-balanced. Note that all characters in the string that are not ,(',')', T. or ,], can be ignored
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
