A: Alphametics |
Alphametics is a term coined by J.A.H. Hunter to design those puzzles where letters represent decimal digits that make true a certain mathematical relation. A well known example for this is the puzzle:
S E N D | |
+
| M O R E |
M O N E Y |
In this context, Alphametic Cryptarithm Masters (ACM) is a recently founded enterprise that is interested on applications of this kind of puzzles to cryptography. For that reason, they want to develop software to solve a reduced family of alphametics in an automated way and you are supposed to help them in this task.
Alphametic puzzles of interest to ACM satisfy the following constraints:
A solution for an alphametic puzzle is a value assignment for the letters in the words of the puzzle statement, such that the equation is satisfied.
The problem input consists of several cases, each one defined by a line with the puzzle statement as described above. It is guaranteed that every problem statement is well formed. The end of the input corresponds to the end of the input file.
Output texts for each input case are presented in the same order that the input is read. For an input case in the puzzle statement, the output should be a ten character expression
SEND + MORE = MONEY CONTEST + ACM = ACIS + ACM + CONTEST VIOLIN + VIOLIN + VIOLA = TRIO + SONATA
OMY**ENDRS ********** AVTSLROIN*