I want to test if an input String is balanced. It would be balanced if there is a matching opening and closing parenthesis, bracket or brace.
example: {} bal
Well, roughly speaking, if it is balanced, that means your stack should be empty.
For that, you need to pop your stack when you parse a }
}
Additional requirement is to check that } is preceded by { or the character popped is a {.
{