Flip-flip-flip

easy
Suresh is an antagonist.
His friend ramesh has given him an expression containing 
'1','0','&' (bitwise AND operator),'|' (bitwise OR operator),'(', and ')'.
This expression results in boolean value (true or false) and then ramesh challenges him to swap the answer i.e if value of expression is true then convert it into true and vice versa and allows him the following operations
Turn a '1' into a '0'.
Turn a '0' into a '1'.
Turn a '&' into a '|'.
Turn a '|' into a '&'.
Cost of changing 1 character is 1.
Note: But the challenging part is that ramesh want the minimum cost to swap the answer.
Now suresh is helpless and need your help.

Input Format

"(0|(1|0&1))" Solution: We can turn "(0|(1|0&1))" into "(0|(0|0&1))" using 1 operation. The new expression evaluates to 0.

Output Format

1

Constraints

1 <= expression.length <= 105
expression only contains '1','0','&','|','(', and ')'
All parentheses are properly matched.
There will be no empty parentheses (i.e: "()" is not a substring of expression).

Notice

NA

Example

Input
(0|(1|0&1))
Output
1
Previous
Confused Robber
Next
New Feature

Related Questions