#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include <stdlib.h>
#define maxn 10
int count[maxn];
//#define LOCAL
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
int n = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
memset(count, 0, sizeof(count));
int num;
scanf("%d", &num);
for (int j = 1; j <= num; j++)
{
char str[10];
//itoa(j, str, 10);
snprintf(str, sizeof(str), "%d", j);
int k = strlen(str);
for (int p = 0; p < k; p++)
{
count[str[p] - '0']= count[str[p] - '0']+1;
}
}
for (int j = 0; j < 9; j++)
{
printf("%d ", count[j]);
}
printf("%d\n", count[9]);
}
return 0;
}
g++不支持itoa
所以将 //itoa(j, str, 10);
改为 snprintf(str, sizeof(str), "%d", j);