implement a java method and c function to check if all parentheses and brackets are balanced, i.e., there are same number of opening and closing paraentheses and brackets, every opening one has a subsequent matching closing one. The input string may contain multiple types of parentheses/brackets, such as () <> [] {}
. For example,
(a)
(a())
(bbb)()
(()())(())
abc
<a>
<a<>>
<bbb><>
<<><>><<>>
{([<abc>])}
{
)
)(
(((}}}
(((abc))
( abc [ xyz ) 123 ] // overlapping pairs, use stack to record all opening chars