SP15383 BFONP - Transform the Expression (Again!)

Description

Have you solved [ONP](../ONP/ "Transform the Expression") problem? Especially using [brainf\*\*k](../../../ranks/ONP/lang=BF "Brainf**k")? This problem will give you extra points if you can solve [ONP](../ONP/ "Transform the Expression") using [brainf\*\*k](../../../ranks/ONP/lang=BF "Brainf**k"). Note that this problem has larger constraints. The task is: "Transform the algebraic expression with brackets into RPN form (Reverse Polish Notation). Two-argument operators: +, -, \*, /, ^ (priority from the lowest to the highest), brackets ( ). Operands: only letters: a,b,...,z. Assume that there is only one RPN form (no expressions like a\*b\*c)."

Input Format

t \[the number of expressions _expression_ \[length = See: "Other Info" part\] \[other expressions\]

Output Format

The _expressions_ in RPN form, one per line.