#jag2017summerday3a. [jag2017summer_day3_a]Star in Parentheses

[jag2017summer_day3_a]Star in Parentheses

MathJax.Hub.Config({ tex2jax: { inlineMath: [["","",""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 16px; line-height: 18px; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }

Problem Statement

You are given a string SS, which is balanced parentheses with a star symbol * inserted.

Any balanced parentheses can be constructed using the following rules:

  • An empty string is balanced.
  • Concatenation of two balanced parentheses is balanced.
  • If TT is balanced parentheses, concatenation of (, TT, and ) in this order is balanced.

For example, ()() and (()()) are balanced parentheses. )( and )()(() are not balanced parentheses.

Your task is to count how many matching pairs of parentheses surround the star.

Let S_iS\_i be the ii-th character of a string SS. The pair of S_lS\_l and S_rS\_r (l<r)(l < r) is called a matching pair of parentheses if S_lS\_l is (, S_rS\_r is ) and the surrounded string by them is balanced when ignoring a star symbol.


Input

The input consists of a single test case formatted as follows.

SS

SS is balanced parentheses with exactly one * inserted somewhere. The length of SS is between 11 and 100100, inclusive.

Output

Print the answer in one line.


Sample Input 1

((*)())

Output for Sample Input 1

2

Sample Input 2

(*)

Output for Sample Input 2

1

Sample Input 3

(()())*

Output for Sample Input 3

0

Sample Input 4

()*()

Output for Sample Input 4

0

Sample Input 5

((((((((((*))))))))))

Output for Sample Input 5

10

Sample Input 6

*

Output for Sample Input 6

0