LogiQuest

196. Infix to Postfix

MediumStackShunting Yard

Convert an infix expression of single lowercase letters, + − * / ^ and parentheses to postfix. ^ is right-associative and has the highest precedence.

Input format

A single line without spaces.

Output format

The postfix expression without spaces.

Example 1

Input

a+b*c

Output

abc*+

Example 2

Input

(a+b)*c

Output

ab+c*

Constraints

1 ≤ length ≤ 10⁴

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…