分类讨论即可
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,i1,i2,s[9],ans=0,o,m;
cin>>a>>b;
for(int i=a;i<=b;i++){
i1=i%100;
i2=i%10000/100;
if(i2>12||i2==0)
continue;
if(i2==1||i2==3||i2==5||i2==7||i2==8||i2==10||i2==12) o=31;
else if(i2==2) o=29;
else o=30;
if(i1>o||i1==0) continue;
m=i;
for(int l=0;m>0;l++){
s[l]=m%10;
m=m/10;
}
if(i2<=12&&i1<=o&&s[0]==s[7]&&s[1]==s[6]&&s[2]==s[5]&&s[3]==s[4])
ans++;
}
cout<<ans<<endl;
return 0;
}