-->
当前位置:首页 > 题库

PROGRAMMING:Single digit statistics

Luz5年前 (2021-05-10)题库422
Given a $$k $$bit integer, $$n = D_{ k-1}10^{k-1} + \cdots + d_ 1 10^1 + d_ 0$$ ($$0\le d_ i \le 9$$, $$i=0,\cdots ,k-1$$, $$d_{ K-1} > 0 $$), please write a program to count the times of each different digit. For example: given $$n = 100311 $$, there are 2 zeros, 3 ones, and 1 3.
###Input format:
Each input contains one test case, which is a positive integer with no more than 1000 bits $$n $.
###Output format:
For each different digit in $$n $, output the digit'd 'and its number of occurrences'm' in a row in the format of'd: M '. It is required to output in ascending order of'd '.
###Input example:
```in
one hundred thousand three hundred and eleven
```
###Output example:
```out
0:2
1:3
3:1
```







answer:If there is no answer, please comment