AdvancedRating 1800
Calculator With Precedence
Evaluate an expression with non-negative integers, + − * /, brackets and spaces. * and / come before + and −; / divides and drops the fraction toward zero (so −7/2 = −3). The input never divides by zero.
Input
One expression.
Output
One integer.
Sample 1
Input
3+2*2
Output
7
Sample 2
Input
3/2
Output
1
Output appears here