6. Vanya thought of a seven-digit number, and then subtracted from it the sum of all the digits except one. He got 9875352. What number would Vanya have gotten if he had subtracted the sum of all the digits except the second from the left?
Solution. Since the number is a seven-digit number, the sum of its digits is no more than 63. Adding 63 to 9875352, we get an upper estimate for the original number: 9875415. We see that in the intended number, after subtracting the sum of all digits, the first four digits do not change (the hundreds place initially has a 4 or 3, so there is no need to borrow from the fourth place). Let the original number be $\overline{9875 a b c}$. If Vanya did not subtract the digit $x$, then the result of obtaining the number 9875352 can be written as:

$$
\overline{9875 a b c}-(9+8+7+5+a+b+c-x)=9875352
$$

Then

$1000000 \cdot 9+100000 \cdot 8+10000 \cdot 7+1000 \cdot 5+100 \cdot a+10 \cdot b+c-(9+8+7+5+a+b+c-x)=$

$$
\begin{gathered}
=1000000 \cdot 9+100000 \cdot 8+10000 \cdot 7+1000 \cdot 5+100 \cdot 3+10 \cdot 5+2 \\
100 \cdot a+10 \cdot b+c-(29+a+b+c-x)=100 \cdot 3+10 \cdot 5+2 \\
100 a+10 b+x-29-a-b=352 \\
99 a+9 b+x=381
\end{gathered}
$$

Since $a, b$, and $x$ are digits, only $a=3$ (2 is not enough, 4 is too much). Then $9 b+x=84$, and from this $b=9, x=3$. Therefore, Vanya did not subtract 3 the first time. Then, if instead of 3, 8 is not subtracted, the result will be 5 more. That is, 9875357.

Answer. 9875357