View Code of Problem 107

#include <iostream>
using  namespace std;

int cnt[10];
int m, n;

void search(int x) {
	while(x) {
		cnt[x % 10]++;
		x /= 10;
	}
}

int main() {
	while(cin >> m >> n) {
		for(int i = m; i <= n; i++) {
			search(i);
		}
		
		for(int i = 0; i <= 9; i++) {
			if(i == 0) cout << cnt[i];
			else cout << " " << cnt[i];
		}
		cout << endl;
		
		for(int i = 0; i <= 9; i++) {
			cnt[i] = 0;
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 107