Brackets Balance

Hi All,
Can any one help me where I am wrong in checking number of pairs of bracket are in correct order.
Question Link:https://www.codechef.com/problems/COMPILER
My submission link:https://www.codechef.com/viewsolution/30575690

Where’s the question link dude??

Link is present now…

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Whenever the stack is empty and you try to access A.top(), you will get a segementation fault due to the undefined behavior of stack.top().
For example : “<<>><>><” will give RTE.

Thank you bro.