public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] digitCount = new int[10];
int factor = 1;
while (n >= factor) {
int lowerDigits = n % factor;
int currentDigit = (n / factor) % 10;
int higherDigits = n / (factor * 10);
for (int i = 0; i < 10; i++) {
digitCount[i] += higherDigits * factor;
}
for (int i = 0; i < currentDigit; i++) {
digitCount[i] += factor;
}
digitCount[currentDigit] += lowerDigits + 1;
digitCount[0] -= factor;
factor *= 10;
}
StringBuilder sb = new StringBuilder();
for (int count : digitCount) {
sb.append(count).append(" ");
}
System.out.println(sb.toString().trim());
}
출처:https://www.acmicpc.net/problem/1019