Converting an infix expression to postfix So the question is to convert the following expression to postfix:

(a+b)^(p+q)^(r*s*t)


The answer I get when I calculate is: ab+pq+^rs*t*^

But the answer is given to be ab+pq+rs*t*^^

I assume that the step when you need to push second '^' into stack when there is already a '^' in the stack is where I went wrong (I pop out the '^' before pushing). Shouldn't we pop out the first '^' as they are of equal precedence ? Or is it an exception to '^' operator ?
There is a sort of an exception to '^', the exponentiation operator since it is right associative. That is, $a^{b^c}$ means $a^{\left({b^c}\right)}$ instead of $\left(a^b\right)^c$. That is, (a+b)^(p+q)^(r*s*t) means (a+b)^((p+q)^(r*s*t)) instead of ((a+b)^(p+q))^(r*s*t).

When you reach the first ^ while evaluating postfix expression ab+pq+rs*t*^^, you will pop out the result of rs*t* and the result of pq+. You get the expected exponentiation as expected.