Question
Mystic Calc
In an enchanted land, Zara uncovers a cryptic string of numbers and operators forming a mathematical expression. She seeks to find all distinct outcomes by grouping the elements differently. Count the total number of unique results she can achieve through all possible groupings.
Input
The first and only line of input contains a string str.
Constraints
1 ≤ |str| ≤ 40
Expression consists of digits and the operator '+', '- ', and '*'.
All the integer values in the input expression are in the range [0, 95].
Constraints
1 ≤ |str| ≤ 40
Expression consists of digits and the operator '+', '- ', and '*'.
All the integer values in the input expression are in the range [0, 95].
Output
Return count of all distinct possible outcomes.
Example
Sample Input
2-1-1
Sample Output
2
Explanation
Possible Arrangements are
1. ((2-1)-1) = 0
2. (2- (1-1)) = 2
2-1-1
Sample Output
2
Explanation
Possible Arrangements are
1. ((2-1)-1) = 0
2. (2- (1-1)) = 2