View Code of Problem 107

#include<bits/stdc++.h>
using namespace std;
int main() {
	int m,n;
	int a[10];
	while(cin>>m>>n)
	{
		memset(a,0,sizeof(a));
		for(int i=m;i<=n;i++)
		{
			stringstream s;
			string h;
			s<<i;
			s>>h;
			for(int j=0;j<h.length();j++)
			{
				a[h[j]-'0']++;
			}
		}
		for(int i=0;i<10;i++)
		{
			if(i==0)
			cout<<a[i];
			else
			cout<<" "<<a[i];
		}
		cout<<endl;
	}

}

Double click to view unformatted code.


Back to problem 107