pythonfrom itertools import permutations
for xs in permutations(range(10), 10):
a, b, c, d, e, f, g, h, i, j = xs
if a == 0 or c == 0 or f == 0:
continue
if (
a * 1000 + b * 100 + a * 10 + b +
c * 100 + d * 10 + e ==
f * 10000 + g * 1000 + h * 100 + i * 10 + j
):
print(xs)output(9, 3, 8, 6, 4, 1, 0, 2, 5, 7)