P1239 Counter
Description
A book has $n$ pages, with page numbers starting from $1$. Please find how many times each of the digits $0,1,2\cdots 9$ appears in all page numbers. No page number has leading zeros; for example, when $n=1234$, page $5$ is not 0005, but just $5$.
Input Format
A single positive integer $n$, the total number of pages.
Output Format
Output ten lines in total, where the $k$-th line is the count of digit $k-1$.
Explanation/Hint
For $100\%$ of the testdata, $1 \le n \le 10^9$.
---
$2022.7.4$: Three new groups of $\text{Hack}$ testdata were added.
Translated by ChatGPT 5