Given two non-negative integers e.g. 27, 96
their multiplication expression would be 27 x 96 = 2592
.
If now each digits is replaced with a symbol, such that
- two digits are replaced with the same symbol if and only if they are equal
we could get something like AB x CD = AECA
or 0Q x 17 = 0Z10
or !> x @^ = !x@!
.
(following this rule we can also get the original expression itself but we'd lose the meaning of the digits being numbers since they will become just placeholders).
We call such an expression a cryptic multiplication of {27, 96}
.
Is clear that some information is lost and the process is not always reversible, indeed an AB x CD = AECA
cryptic multiplication can be obtained from each of the following pairs
{27, 96}
27 x 96 = 2592
{28, 74}
28 x 74 = 2072
{68, 97}
68 x 97 = 6596
There is no other pair of numbers that yields AB x CD = AECA
.
Hence 3 is the cryptic multiplication ambiguity of {27, 96}
Write a function or a program that given two non-negative integers prints their cryptic multiplication ambiguity.
Test cases
{0, 0} -> 2
{5, 1} -> 17
{11, 11} -> 1
{54, 17} -> 18
{10, 49} -> 56
{7, 173} -> 1
{245, 15} -> 27
{216, 999} -> 48
{1173, 72} -> 3
{0, 0} -> 2
test case technically has leading zeroes, though it's a common convention to notate zero as 0 rather than the empty string. \$\endgroup\$02 * 95 = 0190
04 * 65 = 0260
And so on (4 more) \$\endgroup\$