Time Limit: 2 Seconds
Memory Limit: 65536 KB
When we were young, almost everyone liked playing such a game:
Give you an equation, but there is no digit, but capital letters instead. Every
letter stands for a different digit. Your task is to find what is each letter
It's Cx's favourite game! Angel wants to help her to solve every equation to make
We assume that there will be at most 10 letters in the equation. And "+",
"*", "=", "(", and ")" will appear in
the equation. Every result will not exceed 10^9.
One line per testcase stands for the equation with letters. Length of the equation
will not exceed 100.
Proceed to the end of file.
One line per testcase, format as showed in sample output.
If there are more than one solutions, print the "smaller" one in lexical
order (for example, "A=0 B=1" < "A=1 B=0", and we assume
that if one number is "ABC", and A=0 is illegal).
If there is no solution, print one line contains "Poor Angel".
Author: JIANG, Yanyan
Source: JIANG, Yanyan's Contest #1