hanyr @ 2022-03-11 15:36:31
#include<bits/stdc++.h>
using namespace std;
int a,b,y,y2,m1,m2,d1,d2;
int strtonum(string x){
if(x.size()==0)
return 0;
else
{stringstream sstream(x);
int v;
sstream>>v;
return v;}
}
string to_string1(int num){
stringstream sstream;
string s;
sstream<<num;
if((num/100)<10)
{
sstream>>s;
s.insert(0,"0");
}
else
sstream>>s;
return s;
}
int r(int x){
return (x%4==0&&x%100!=0||x%400==0)?29:28;
}
bool ishui(int y,int m,int d){
int c=y*10000+m*100+d;
int g=c/10000;
string e;
e=to_string1(c%10000);
reverse(e.begin(),e.end());
int f=strtonum(e);
if(f==g)
return true;
else
{return false;}
}
int main(){
int sum=0;
cin>>a>>b;
y=a/10000;
m1=a%10000/100;
d1=a%100;
y2=b/10000;
m2=b%10000/100;
d2=b%100;
while(y<y2||y==y2&&m1<m2||y==y2&&m1==m2&&d1<d2){
if(ishui(y,m1,d1))
{sum++;}
if(m1==12&&d1==31)
{m1=1;d1=0;y++;}
if(m1==2&&d1==r(m1)||((m1==1||m1==3||m1==5||m1==7||m1==8||m1==10)&&d1==31)||((m1==4||m1==6||m1==9||m1==11)&&d1==30))
{
m1++;d1=0;
}
d1++;
}
if(a==b)
{if(sum>0)
sum=1;
else
sum=0;
}
cout<<sum<<endl;
return 0;
}