View Code of Problem 107

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<climits>
#include<cmath>
#include<map>
#include<set>

using namespace std;


int main()
{
	int m, n;
	while (cin >> m >> n) {

		int count[10] = { 0 };

		for (int i = m; i <= n; i++) {

			string str = to_string(i);

			for (int j = 0; j < str.size(); j++) {

				count[str[j] - '0']++;
			}
		}

		for (int i = 0; i < 10; i++) {

			cout << count[i];

			if (i != 9)
				cout << " ";
		}

		cout << endl;
	}
}

Double click to view unformatted code.


Back to problem 107