View Code of Problem 107

#include <bits/stdc++.h>
using namespace std;
#define N 10
int main()
{
	int a[N];
	int n,m;
	while(cin>>m>>n) {
		memset(a,0,sizeof(int)*N); 
		for(int i=m;i<=n;i++) {
			int k=i;
			do{
				a[k%10]++;
				k/=10;
			}while(k>0);
		}
		for(int i=0;i<N;i++){
			cout<<a[i];
			if(i<N-1)
				cout<<" ";
		}
		cout<<endl;
	}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 107