Redundant parentheses

Code - https://ide.codingblocks.com/s/38479
Ques - https://hack.codingblocks.com/contests/c/511/1286
Working in CB ide and sublime text but showing the wrong answer while submitting.

Hey! Your code is not handling all the test cases . For example:

((a+b)+(c+d))

for this your code’s output is “Duplicate”
but the correct output is “Not Duplicate”

Thanks, Can u Elaborate more with some good examples, Coz I am slightly confused between Duplicate and Not Duplicate.

Duplicate :
If any expression is enclosed by more than one pair of parenthesis
for eg : (x+y) + ((w+z)) or ((x+y)+((w+z)))
as in this w+z is surrounded by 2 pairs of parenthesis

Not Duplicate:
If all the expressions are enclosed in valid pair of parenthesis
for eg: ((x+y)+(w+z)) or ((x+(y))+(w+z))

1 Like