ARITHMETIC PUZZLE
An arithmetic puzzle is an expression in the format M&N=P, where M, N, and P are sequences composed of digits (0 through 9) and/or Latin letters (a through j), which stand for unknown digits. The symbol & represents one of the operations: either + or *.
To solve the puzzle, you must replace each letter with a digit to form a valid equation, adhering to the following rules:
Identical letters throughout the puzzle must be replaced by the same digit, which cannot be one of the known digits. Different letters must be replaced by different digits, also not among the known digits.
The first digit of the numbers M, N, and P cannot be zero, and each of these numbers must not exceed 999999.
Input: A single line containing one arithmetic puzzle.
Output: Provide any valid solution to the puzzle, or output 0 (zero) if no solution exists.