Find all pairs of numbers $(n, k)$ such that in the decimal system:

$n^{n}$ is written with $k$ digits,

$k^{k}$ is written with $n$ digits.
Suppose that ( $n, k$ ) is a solution. By symmetry, we can assume $n \geq k$.

If $n>k$ then we have $n^{n}>k^{k}$ but $n^{n}$ has $k$ digits and thus strictly fewer digits than $k^{k}$, which is absurd. Therefore, $k=n$.

We need to find the numbers $n$ such that $n^{n}$ can be written with $n$ digits.

Furthermore, if $n \geq 10$ we have $n^{n} \geq 10^{n}$ and since $10^{n}$ is written with $n+1$ digits, then $n^{n}$ cannot be written with $n$ digits. Therefore, $n<10$.

We then try the different values between 1 and 9 and find that the only solutions are: $(1,1),(8,8)$ and $(9,9)$.