View Code of Problem 107

#include <iostream>
#include <string>
using namespace std;

int main() {
	int m,n;
	while(cin >>m>>n){
		int a[10]={0};
		for(int i=m;i<=n;i++){
			char su[6];
			string str;
			sprintf(su,"%d",i);
			str=su;
			for(int j=0;j<str.length();j++){
				a[str[j]-'0']++;;
			}
			
			//cout <<str;
		}
		for(int i=0;i<10;i++){
			if(i==0)
				cout << a[i];
			else
				cout <<" "<<a[i];
		}
		cout <<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 107