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() {
	int i;
	while(cin >> a >> b )
    {
    	for (int i = a; i <= b; i ++) f_count(i);
    for(i=0;i<10;i++)
	{
		if(i==0) cout<<cnt[i];
    else
    {	
    	printf(" %d",cnt[i]);
	}
		}
		cout<<endl;	
	for(i=0;i<10;i++)
	cnt[i]=0;
	}
    
}

Double click to view unformatted code.


Back to problem 107