View Code of Problem 3594

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

int main()
{
	int t;
	cin >> t;
	while(t --)
	{
		int a, b;
		cin >> a >> b;
		int number = 0;
		for(int i = a;i <= b;i ++)
		{
			unordered_map<char,int> hash;
			string s = to_string(i);
			for(int j = 0;j < s.size();j ++) hash[s[j]] ++;
			bool flag = true;
			for(auto x : hash)
			{
				if(x.second > 1) flag = false;
			}
			if(flag) number ++;
			hash.clear();
		}
		cout << number << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3594