#C9603. Balanced Expression Validator
Balanced Expression Validator
Balanced Expression Validator
You are given a mathematical expression as a string. Your task is to determine if the expression contains balanced delimiters for parentheses, brackets, and braces. An expression is considered balanced if every opening symbol has a corresponding closing symbol in the correct order. For example, an expression is valid if $$ (a+b)*(c-d) $$ is balanced. Use a stack-based approach to solve this problem.
inputFormat
Input is read from standard input (stdin) and consists of a single line string representing the mathematical expression. The expression may include letters, digits, arithmetic operators, and the characters '(', ')', '[', ']', '{', '}'.
outputFormat
Print to standard output (stdout) a single line: either 'True' if the expression is balanced or 'False' otherwise.## sample
(a+b)*(c-d)
True