View Code of Problem 107

#include<iostream>

using namespace std;

int main()
{
    int m,n;
    while(cin>>m>>n)
    {
        int a[10]={0};
    for(int i=m;i<=n;i++)
    {
        int temp=i;
        while(true)
        {
            if(temp<10) break;
            a[temp%10]++;
            temp/=10;
        }
        a[temp]++;
    }
    for(int i=0;i<9;i++)
        cout<<a[i]<<" ";
        cout<<a[9]<<endl;
    }
}

Double click to view unformatted code.


Back to problem 107