View Code of Problem 107

#include <bits/stdc++.h>
using namespace std;
int a, b, cnt[10];
void f_count(int num) {
    while (num > 0) {
        cnt[ num % 10 ] ++;
        num /= 10;
    }
}
int main() {
    cin >> a >> b;
    for (int i = a; i <= b; i ++) f_count(i);
    for (int i = 0; i < 10; i ++) {
        if (i) putchar(' ');
        cout << cnt[i];
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 107