{"raw_statement":[{"iden":"problem statement","content":"Given is a string $S$ consisting of `(`, `)`, `o`, and `x`. You can swap two adjacent characters in $S$ any number of times. Find the minimum number of swaps needed to satisfy the following condition.\n\n*   Let us make a string $S'$ consisting of `(` and `)` by replacing every occurrence of `o` with `()` and every occurrence of `x` with `)(` in $S$. Then, $S'$ is a **balanced parenthesis string**.\n\nDefinition of a balanced parenthesis stringA balanced parenthesis string is a string that is one of the following:\n\n*   an empty string;\n*   a string that is a concatenation of $s$, $t$ in this order, where $s$ and $t$ are some non-empty balanced parenthesis strings;\n*   a string that is a concatenation of `(`, $s$, `)` in this order, where $s$ is some balanced parenthesis string.\n\nUnder the Constraints of this problem, it is always possible to achieve the objective."},{"iden":"constraints","content":"*   $S$ is a string consisting of `(`, `)`, `o`, and `x`.\n*   $S$ contains the same non-zero number of `(`s and `)`s.\n*   $|S| \\leq 8000$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$S$"},{"iden":"sample input 1","content":")x("},{"iden":"sample output 1","content":"3\n\nWe should do as follows: `)x(` → `x)(` → `x()` → `(x)`. Here, we have $S'=$`()()`, which is a balanced parenthesis string."},{"iden":"sample input 2","content":"()ox"},{"iden":"sample output 2","content":"2"},{"iden":"sample input 3","content":"()oxo(xxx))))oox((oooxxoxo)oxo)ooo(xxx(oox(x)(x()x"},{"iden":"sample output 3","content":"68"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}