#SDNU1645. expression solver
expression solver
Description
By solve expression day by day, jvm is so hard, wzl think. So he ask you to achieve a expression solve program to help jvm.
Format
Input
Input is terminated by end of file each line, it can be : 1. define a var, format like: int [var] ([var] means a var's name), or with initialization: int [var]=[expr] ([expr] means a expression), var's name never exits twice. 2. an expression, guarantee the var not initialized will only exist behind =, after that, the var is initialized. guarantee every expression can be run normally in java or c\c++, and there is none extra space the operator only contain value type only contains int, guarantee int overflow never happen at most 1000 lines, every line would not exceed 1000 chars
Output
in every expression line, out put what the expression's return value
Samples
int a
int b=123
a=b
a=b*2+4
a+b
a/b+4
a%b+12
a+b-12+4
123
250
373
6
16
365
int a=12
int b=a
b=a=124
b+a+12*12
b=a=12
b*a/4
b*a/7
b*-a/7
124
392
12
36
20
-20
Hints
because this expression would run normally in java or c\c++, so if you use python or some language whose integer divide's is not use towards zero, some error may be happen