Skip to content
C

Evaluate Postfix Expression

Mediumjavapythonccppjavascript

Given a valid postfix (Reverse Polish) expression of integers and the operators +, -, *, /, evaluate it. Division truncates toward zero.

Input Format

The first line contains an integer N, the number of tokens. The second line contains N space-separated tokens: each is an integer or one of + - * /.

Output Format

Print the integer value of the expression.

Input (stdin)

Output

Run your code to see output here...