7. For any positive integer $n$, define
$$
S(n)=\left[\frac{n}{10^{[\lg n]}}\right]+10\left(n-10^{[\lg n]}\left[\frac{n}{10^{[\lg n]}}\right]\right) \text {. }
$$

Then among the positive integers $1,2, \cdots, 5000$, the number of positive integers $n$ that satisfy $S(S(n))=n$ is $\qquad$ .
7. 135.

Let $t=10^{[18 n]}$, then
$$
S(n)=\left[\frac{n}{t}\right]+10\left(n-t\left[\frac{n}{t}\right]\right)
$$

Notice that, $n-t\left[\frac{n}{t}\right]$ is the remainder of $n$ modulo $t$, and $\left[\frac{n}{t}\right]$ is the leading digit of $n$.
We will discuss the cases separately.
(1) If $n$ is a one-digit number, then all such $n$ satisfy the condition, and there are 9 such $n$;
(2) If $n$ is a two-digit number, let $n=\overline{x y}$, then
$$
S(n)=\overline{y x}, S(S(n))=\overline{x y} \text {, }
$$

There are 81 such $n$, where $x, y \neq 0$;
(3) If $n$ is a three-digit number, let $n=\overline{x y z}$, then
$$
S(n)=\overline{y z x}, S(S(n))=\overline{z x y} \text {, }
$$

Thus, $x=y=z \neq 0$, and there are 9 such $n$;
(4) If $n$ is a four-digit number, let $n=\overline{x y z w}$, then
$$
S(S(n))=\overline{z w x y} \text {, }
$$

Thus, $w=y, z=x$, and there are 36 such $n$, where $x=1,2,3,4, y \neq 0$.

In summary, the number of positive integers $n$ that satisfy the condition is 135.