ABC-rebuses
Arithmetic puzzles are expressions made up of letters from the English alphabet and arithmetic operation signs. To solve the puzzle, each letter must be replaced with a digit from 1 to 9, ensuring that:
Identical letters are replaced with the same digit;
Different letters are replaced with different digits;
The resulting numerical equation is valid.
For example, the solution to the puzzle HE*HE=SHE is the numerical equation 25*25=625.
In this task, you need to solve a puzzle in the form X+Y=Z, where X
, Y
, and Z
are strings consisting only of the characters 'A
', 'B
', 'C
'. It is guaranteed that each puzzle has a unique solution.
Input
A single line containing the puzzle in the form X+Y=Z, where X
, Y
, and Z
are strings with lengths ranging from 1 to 9 characters, consisting only of the characters 'A
', 'B
', 'C
'.
Output
A single line representing the solution to the puzzle.