#K10161. Balanced Parentheses Checker

    ID: 23186 Type: Default 1000ms 256MiB

Balanced Parentheses Checker

Balanced Parentheses Checker

Given a string consisting solely of the characters ( and ), determine if the string is balanced. A string is considered balanced if every opening parenthesis ( has a corresponding closing parenthesis ), and the parentheses are in the correct order. Formally, if we define a function that processes the string from left to right, at no point should the number of closing parentheses exceed the number of opening ones, and overall the totals should be equal. For instance, (()) is balanced, whereas ((()) is not.

inputFormat

The input consists of a single line containing a non-empty string of characters. Each character will be either ( or ).

outputFormat

Output a single line with Yes if the string is balanced, or No otherwise.

## sample
()
Yes