#include<bits/stdc++.h>
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
using namespace std;
bool RepeatedDigit(int x)
{
stringstream ss;
ss<<x;
string s =ss.str();
set<char>st;
ff(j,0,s.size())
st.insert(s[j]);
if(st.size()==s.size())
return true;
return false;
}
int main()
{
int s , t;
while(cin>>s>>t){
int cnt=0;
ff(i,s,t+1){
if(RepeatedDigit(i)==true)
cnt++;
}
cout<<cnt<<endl;
}
return 0;
}
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
using namespace std;
bool RepeatedDigit(int x)
{
stringstream ss;
ss<<x;
string s =ss.str();
set<char>st;
ff(j,0,s.size())
st.insert(s[j]);
if(st.size()==s.size())
return true;
return false;
}
int main()
{
int s , t;
while(cin>>s>>t){
int cnt=0;
ff(i,s,t+1){
if(RepeatedDigit(i)==true)
cnt++;
}
cout<<cnt<<endl;
}
return 0;
}
No comments:
Post a Comment