Marijn wrote an expression to calculate the answer to the ultimate question. Unfortunately, his friend Jeroen decided to pull a prank and shuffled all the characters in his expression!
The syntax of the expression is similar to that of most programming languages (in fact, the expression is valid Python):
An example of a valid expression is "!(abc+var0)*(12+0)!", where the addition of two variables "abc" and "var0" is multiplied by the addition of "12" and "0".
Luckily, Marijn remembers that he did not use any unnecessary parentheses in his code. This means that for example "a+(b+c)!" does not appear because the '+' operator is associative, nor does "!(a*b)+c" since the '*' operator takes precedence over '+'. Note: it is not required that removing any of the parentheses actually changes the outcome of the expression.
Given a shuffled expression, help Marijn find any expression that could have been his original expression, if such an expression exists.
The input consists of:
If an expression exists that satisfies all the requirements, output "possible" followed by such a permutation of the input string. Otherwise, output "impossible".
If there are multiple valid solutions, you may output any one of them.
7123test
possible test321
10012var+*()
possible (var2+0)*1
7(1+2)+3
impossible
7(000+*)
possible (0+0)*0
200
impossible
9((1+2))*3
impossible
10bilmseiops
possible impossible