#C14914. Balanced Parentheses Checker

    ID: 44616 Type: Default 1000ms 256MiB

Balanced Parentheses Checker

Balanced Parentheses Checker

Given a string, determine whether the parentheses in the string are balanced. A string is said to have balanced parentheses if every opening parenthesis '(' has a corresponding closing parenthesis ')' in the correct order. The condition can be mathematically represented as: $$\forall i,, #( '(' ) = #( ')' )$$ during proper sequential traversal. This problem requires you to check the balance of parentheses among other characters. For example, the string abc(def)ghi is balanced, whereas a(b)c)d( is not.

inputFormat

Input consists of a single line containing a string. The string may contain letters, digits, spaces, and special characters including parentheses.

outputFormat

Output a single line: either 'True' if the parentheses in the input string are balanced, or 'False' otherwise.## sample

abc(def)ghi
True