4. The number of roots of the equation $|1-| x||+\sqrt{|x|-2}$ $=x$ with respect to $x$ is ( ).
(A) 0
(B) 1
(C) 3
(D) 4
4.B.

It is clear that $x \geqslant 0$, so $|1-x|+\sqrt{x-2}=x$. And $x \geqslant 2$. Thus, $x-1+\sqrt{x-2}=x$. Therefore, $\sqrt{x-2}=1$.