Uva 12527 Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, i, j;

    while(cin >> n >> m)
    {
        int c = 0;

        for(i=n;i<=m;i++)
        {
            string s = to_string(i);
            set<char>p;

            for(j=0;j<s.size();j++)
            {
                p.insert(s[j]);
            }

            if(p.size() == s.size())
                c++;
        }

        cout << c << endl;
    }

    return 0;
}

Comments