Problem K. Problem K. Expression in Memories

时间限制 1000 ms   内存限制 256 MB

Kazari remembered that she had an expression $s_0$ before.
Definition of expression is given below in Backus–Naur form.
<expression> ::= <number> | <expression> <operator> <number>
<operator> ::= "+" | "*"
<number> ::= "0" | <non-zero-digit> <digits>
<digits> ::= "" | <digits> <digit>
<digit> ::= "0" | <non-zero-digit>
<non-zero-digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
For example, `1*1+1`, `0+8+17` are valid expressions, while +1+1, +1*+1, 01+001 are not.
Though $s_0$ has been lost in the past few years, it is still in her memories.
She remembers several corresponding characters while others are represented as question marks.
Could you help Kazari to find a possible valid expression $s_0$ according to her memories, represented as $s$, by replacing each question mark in $s$ with a character in 0123456789+* ?
 

输入数据

The first line of the input contains an integer $T$ denoting the number of test cases.
Each test case consists of one line with a string $s$ $(1 \le |s| \le 500, \sum {|s|} \le 10 ^ 5)$.
It is guaranteed that each character of $s$ will be in 0123456789+*? .
 

输出数据

For each test case, print a string $s_0$ representing a possible valid expression.
If there are multiple answers, print any of them.
If it is impossible to find such an expression, print IMPOSSIBLE.
 

样例输入

复制
5
?????
0+0+0
?+*??
?0+?0
?0+0?

样例输出

复制
11111
0+0+0
IMPOSSIBLE
10+10
IMPOSSIBLE

提交

请先 登录

© 2025 FAQs Contact About