eolymp
bolt
Try our new interface for solving problems
Problems

Digits Count

Digits Count

Diana is going to write a list of all positive integers between \textbf{A} and \textbf{B}, inclusive, in base \textbf{10} and without any leading zeros. She wants to know how many times each digit is going to be used. \InputFile Each test case is given in a single line that contains two integers \textbf{A} and \textbf{B} (\textbf{1} ≤ \textbf{A} ≤ \textbf{B} ≤ \textbf{10^8}). The last test case is followed by a line containing two zeros. \OutputFile For each test case output a single line with 10 integers representing the number of times each digit is used when writing all integers between \textbf{A} and \textbf{B}, inclusive, in base \textbf{10} and without leading zeros. Write the counter for each digit in increasing order from \textbf{0} to \textbf{9}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1 9
12 321
5987 6123
12345678 12345679
0 0
Output example #1
0 1 1 1 1 1 1 1 1 1
61 169 163 83 61 61 61 61 61 61
134 58 28 24 23 36 147 24 27 47
0 2 2 2 2 2 2 2 1 1
Source ACM ICPC 2010 – Latin American Regional