A string of characters has balanced braces (parentheses, curly braces, and square braces) if each right-facing brace occurring in the string is matched with a preceding left-facing brace. Further, braces should be properly contained. That is, if one type of brace is opened before a second, the second must be closed before the first. For example,
{ [ ] }
is okay but
{ [ } ]
is not.
Write a program that uses a stack to determine whether a string entered at the keyboard has balanced braces. Implement a character stack to solve this problem (do not use templates).
传送门:https://pan.baidu.com/s/1JJs9vbZahUCB6cQvXLgAVg?pwd=1111