_Kouki_ @ 2021-09-25 17:18:10
#include<bits/stdc++.h>
using namespace std;
int ans=0;
int month_day[13]=
{
0,31,28,31,30,31,30,31,31,30,31,30,31
};
string date1,date2;
int year_1,month_1,day_1;
int year_2,month_2,day_2;
int year_now,month_now,day_now;
void inpt()
{
cin>>date1>>date2;
year_1=(date1[0]-'0')*1000+(date1[1]-'0')*100+(date1[2]-'0')*10+(date1[3]-'0');
month_1=(date1[4]-'0')*10+(date1[5]-'0');
day_1=(date1[6]-'0')*10+(date1[7]-'0');
year_2=(date2[0]-'0')*1000+(date2[1]-'0')*100+(date2[2]-'0')*10+(date2[3]-'0');
month_2=(date2[4]-'0')*10+(date2[5]-'0');
day_2=(date2[6]-'0')*10+(date2[7]-'0');
year_now=year_1;
month_now=month_1;
day_now=day_1;
}
bool pd(int year)
{
if(year%4==0)
{
if(year%100==0)
{
if(year%400==0)
{
return true;
}
return false;
}
return true;
}
return false;
}
void dfs(int year,int month,int day)
{
if(month!=2)
{
if(day>month_day[month])
{
day-=month_day[month];
month++;
}
}else
{
if(pd(year))
{
if(day>29)
{
day-=29;
month++;
}
}else
{
if(day>28)
{
day-=28;
month++;
}
}
}
if(month>12)
{
year++;
month-=12;
}
if(year==year_2&&month==month_2&&day==day_2) return;
int day_dl=(day%10)*10+(day/10%10);
int month_dl=(month%10)*10+(month/10%10);
int year_zh=day_dl*100+month_dl;
if(year==year_zh) ans++;
dfs(year,month,day+1);
}
int main()
{
inpt();
dfs(year_now,month_now,day_now);
printf("%d",ans);
}