On four cards, there were four different digits, one of which was zero. Vojta formed the largest four-digit number from the cards, Martin then the smallest four-digit number. Adam wrote the difference between Vojta's and Martin's numbers on the board.

Then Vojta formed the largest three-digit number from the cards, and Martin the smallest three-digit number. Adam again wrote the difference between Vojta's and Martin's numbers on the board. Then Vojta and Martin similarly formed two-digit numbers, and Adam wrote their difference on the board. Finally, Vojta chose the largest one-digit number, and Martin the smallest non-zero one-digit number, and Adam wrote their difference on the board.

When Adam added all four differences on the board, he got 9090. Determine the four digits on the cards.

(L. Růžičková)

Hint. Express the result generally using the unknown digits on the cards.
Let's denote three non-zero digits on cards as $a, b, c$ and assume that $a<b<c$. Vojta's numbers were $\overline{c b a 0}, \overline{c b a}, \overline{c b}$, and $c$, while Martin's numbers were $\overline{a 0 b c}, \overline{a 0 b}$, $\overline{a 0}$, and $a$. Adam's sum of differences of pairs of these numbers can be expressed in expanded form, after simplification, as $1110 c + 100 b - 1100 a$. According to the problem, this sum equals 9090, which is equivalent to the equation

$$
111 c + 10 b - 110 a = 909
$$

where $0 < a < b < c < 10$. Since only the first addend contributes to the units place, $c$ must be 9. After substituting and simplifying, we get

$$
11 a - b = 9,
$$

where $0 < a < b < 9$. The only solution to this problem is the pair $a = 1$ and $b = 2$. (If $a \geq 2$, then $b \geq 13$, which is not possible.)

The digits on the cards were $0, 1, 2$, and 9.

Note. If we focus on the values in the units, tens, etc., places in Adam's sum, we get an equivalent equation to (1):

$$
100(c - a) + 10(b + c - a) + c = 909.
$$

From this, it follows that $c = 9$ and either $b + c - a = 0, c - a = 9$, or $b + c - a = 10, c - a = 8$. Since $a$ and $c$ are different non-zero digits, the difference $c - a$ is different from $c$. Therefore, the second option must occur, and by successive substitution, we determine $a = 1$ and $b = 2$.