~/algor $ cat problems/string-qavslar-chuqurligi
Bracket depth
Medium
1000 ms
128 MB
58%
A string $s$ that is a correct bracket sequence is given (every ( has a matching )). Find its depth — the largest number of brackets open at the same time.
Input
One line containing the string $s$.
Output
One integer.
Note
$2 \le |s| \le 2 * 10^{5}$
$s$ is a correct bracket sequence of the characters ( and )
Examples
Input #1
(()(()))
Output #1
3
Input #2
()()
Output #2
1