|
|||
Free ParenthesesYou are given a simple arithmetic expression which consists of only addition and subtraction operators. For example:
You are free to put any parentheses to the expression anywhere you want and as many as you want. However, it should be a valid expression after you put the parentheses. The question is how many different resulting values can you make? For example, adding parentheses to the above expression can give you 6 different values:
Input SpecificationThere will be several expressions in the input. Each expression is written in one line. The expression consists of only N (2 ≤ N ≤ 30) nonnegative numbers less than 100, separated by addition or subtraction operators. There will be no operator before the first number. Output SpecificationFor each expression, print the number of different values that can be derived from the expression by adding any number of parentheses. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 03/01/2019 |