AT_past202212_e 括弧列
Description
A string consisting of `(` and `)` is said to be a **correct bracket sequence** if it can be made empty by erasing a contiguous occurrence of `()` zero or more times.
- For instance, `()`, `(())`, and `(()())()` are correct bracket sequences, while `)(`, `())`, and `(()()))(()` are not.
You are given a string $ S $ consisting of `(` and `)`. Determine whether $ S $ is a correct bracket sequence.
Input Format
The input is given from Standard Input in the following format:
> $ S $
Output Format
If $ S $ is a correct bracket sequence, print `Yes`; otherwise, print `No`.
Explanation/Hint
### Sample Explanation 1
One can make $ S $ empty by removing consecutive occurrences of `()` as follows, so $ S $ is a correct bracket sequence.
- Remove the second and third characters of the current string, making it `()`.
- Remove the first and second characters of the current string, making it empty.
### Constraints
- $ S $ is a non-empty string of length at most $ 2 \times 10^5 $ consisting of `(` and `)`.