In this problem you must evaluate a sequence of simple C expressions, but you do not need to know C to solve it. Each expression appears on a line by itself and contains at most 80 characters. The expressions contain only simple integer variables and a limited set of operators; no constants appear.
There are 26 variables that may appear, namely a through z (lower-case letters only). At the beginning of evaluating each expression, these 26 variables hold the integer values 1 through 26 respectively (that is, a = 1, b = 2, ..., z = 26). Each variable appears at most once in an expression, and many variables may not be used at all.
The operators are:
+ and -, with the usual meaning. Thus a + c - d + b has the value 1 + 3 - 4 + 2 = 2.++ and --, which may appear before or after a variable.
++ appears before a variable (prefix), that variable is incremented by one before its value is used in determining the value of the whole expression. Thus ++c - b has the value 2, with c incremented to 4 before evaluation.++ appears after a variable (postfix), that variable is incremented by one after its value is used. Thus c++ - b has the value 1, but c becomes 4 after the whole expression is evaluated.-- operator works the same way, before or after a variable, decrementing it by one. Thus --c + b-- has the value 4, with b and c ending at 1 and 2 after evaluation.Here is a more algorithmic description of ++ and -- (we describe only ++, for brevity):
++ before it. Write a statement that increments each such variable, and remove the ++ from before that variable.++ after it. Write a statement that increments each such variable, and remove the ++ from after that variable.++ remains before or after any variable. Write the statement that evaluates the remaining expression; it goes after the statements from step 1 and before those from step 2.Using this approach, evaluating ++a + b++ is equivalent to:
a = a + 1 (step 1)expression = a + b (step 3)b = b + 1 (step 2)where expression receives the value of the whole expression.
Read expressions, one per line, until a completely blank (or empty) line is read.
Blanks are ignored when evaluating an expression. Ambiguous expressions such as a+++b (ambiguous because it could be treated as a++ + b or a + ++b) will not appear in the input. Likewise, a ++ or -- operator will never appear both before and after a single variable, so expressions such as ++a++ will not appear.
For each expression, first print the expression exactly as it was read, prefixed by Expression: . On the next line print the value of the whole expression, and then, one per line, the value of each variable that was used in the expression, after evaluation. Do not print variables that were not used.
Each value line and each variable line is indented with four spaces. The value line has the form value = <value>, and each variable line has the form <variable> = <value>. The used variables are listed in alphabetical order (a to z).