Example 4 (Problem from the 32nd American High School Mathematics Examination) In the ternary system, the representation of number $x$ is: 12112211122211112222, then what is the leftmost digit of $x$ in the nonary system?
Solve: Pairing the digits of the ternary representation of $x$, we get
$$
\begin{aligned}
x & =\left(1 \cdot 3^{19}+2 \cdot 3^{18}\right)+\left(1 \cdot 3^{17}+1 \cdot 3^{16}\right)+\cdots+(2 \cdot 3+2) \\
& =(1 \cdot 3+2) \cdot\left(3^{2}\right)^{9}+(1 \cdot 3+2) \cdot\left(3^{2}\right)^{8}+\cdots+(2 \cdot 3+2) .
\end{aligned}
$$

Therefore, the first digit of the nonary (base-9) representation of $x$ is $1 \cdot 3+2=5$.