what is the problem in the above code it does not produce the right output??
Check the balanced parenthesis?
Your found was 1 at the time of initialization as well. So it always produces the output “not balanced”.
I modified your code. Check it out -