Problem
Input format
A single line contains the postfix expression, with tokens separated by spaces. - the expression has at most `5000` characters; - all intermediate numbers and the final result fit in `long long`; - division is integer division between strictly positive numbers; - the expression is always valid (no error checking is required).
Output format
The program prints to standard output the value of the expression, followed by a newline.
Example
3 4 + 2 *
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
3 4 + 2 *
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.