This problem revolves around the Polish notation.
- Polish notation is the way to write parenthesis-free expressions. Its distinguishing feature is that it places operators to the left of their operands.
- expression ::= number | (operator expression expression)
- operator ::= | | | | …
- For example: "" is "".
You are given a Polish notation expression. Operators can be only and . Each number in expression is replaced with . You have to replace each with positive integer number, so that value of expression was . Also, you have to make the biggest number in expression as small as possible.
Input Format
The only line contains string with expression (string will contain only '?', '+' and '-').
Constraints
- string length .
Output Format
Return an integer array, number should be the number for '?' in the string. If there are many solutions print any.
Sample Input 0
-?-??
Sample Output 0
1
2
1
Explanation 0
- 1 - 2 1 is 1-(2-1) = 0