UVA-1225 - Digit Counting

  • UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt
  • 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
  • 本題選為「20170523 大學程式能力檢定 CPE」題目。

題意概要

簡單來說,假設給定 ,則會將 ~ 串接起來,形成一個數字 ,題目希望求得在這個數字中 ~ 個別出現的次數。以上述 為例:

要統計的數字 0 1 2 3 4 5 6 7 8 9
出現次數 1 6 2 2 1 1 1 1 1 1

Input

The input file consists of several data sets. The first line of the input file contains the number of data sets which is a positive integer and is not bigger than 20. The following lines describe the data sets. For each test case, there is one single line containing the number .


Output

For each test case, write sequentially in one line the number of digit 0, 1, …, 9 separated by a space.


Sample Input

2
3
13

Sample Output

0 1 1 1 0 0 0 0 0 0
1 6 2 2 1 1 1 1 1 1
profile-image
Yung-Sheng Lu
Hello, I'm Yung-Sheng Lu. I am a graduate student in Department of Computer Science at National Chiao Tung University, Taiwan. I am in the Networking and Sensing Systems (NSS) Lab at NCTU.
comments powered by Disqus