Problem
Input format
The program reads from standard input a single line containing the postfix expression. Numbers are non-negative integers (at most 9 digits) and are separated from operators by spaces. - The expression is well-formed; no division by zero occurs. - The number of tokens is at most 200. - All intermediate values and the result fit in `long long`. - For a binary operator `op`, the two tokens at the top of the stack are its operands: the first popped is the right operand.
Output format
The program prints to standard output a single integer: the value of the expression.
Example
2 3 4 * +
14
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
2 3 4 * +
14
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.