View Code of Problem 107

#include<iostream>
using namespace std;
int main()
{
	int a, b;
	while(cin >> a >> b)
	{
		int ans[10] = {0};
		a = min(a,b),b = max(a,b);
		for(int i = a;i <= b;i ++)
		{
			int k = i;
			while(k)
			{
				ans[k % 10] ++;
				k /= 10;
			}
		}
		for(int i = 0;i < 10;i ++) 
		{
			if(i == 0) cout << ans[i];
			else cout << " " << ans[i];
		}
		cout << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 107