#C14576. Balanced Parentheses Check

    ID: 44240 Type: Default 1000ms 256MiB

Balanced Parentheses Check

Balanced Parentheses Check

This problem requires you to determine whether a string consisting solely of the characters '(' and ')' is balanced. A string is said to be balanced if every opening parenthesis has a corresponding closing parenthesis and the pairs of parentheses are properly nested. Formally, for a string \( S \) the condition of being balanced can be expressed as:

\(\text{Let } S = s_1 s_2 \ldots s_n \). Then, for all prefixes \( s_1 s_2 \ldots s_k \) (for \( 1 \leq k \leq n \)), the number of '(' is at least the number of ')', and overall the total number of '(' equals the total number of ')'.\)

Implement a solution that reads the input from stdin and prints the result to stdout as either True or False.

inputFormat

The input consists of a single line containing a non-empty string \( S \) which is made up exclusively of characters '(' and ')'.

outputFormat

Output a single line with True if the string is balanced, or False otherwise.

## sample
()
True