直接模拟,要考虑同一年,同年同月,同年同月同日(0),后面的日期靠前等情况
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cctype>
#include<ctime>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define Forp(x) for(int p=pre[x];p;p=next[p])
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int is_l(int y)
{
if (y%4==0&&y%100!=0) return 366;
if (y%400==0) return 366;return 365;
}
int main()
{
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
int y1,m1,d1,y2,m2,d2;
scanf("%d:%d:%d",&y1,&m1,&d1);
scanf("%d:%d:%d",&y2,&m2,&d2);
if (y1>y2||(y1==y2&&m1>m2)||(y1==y2&&m1==m2&&d1>d2)) swap(y1,y2),swap(m1,m2),swap(d1,d2);
int tot=0;
Fork(i,y1+1,y2-1) tot+=is_l(i);
if (y1^y2)
{
if (m1<2) tot+=is_l(y1)==366?29:28;
if (m2>2) tot+=is_l(y2)==366?29:28;
Fork(i,m1+1,12) if (i!=2) tot+=a[i];
Fork(i,1,m2-1) if (i!=2) tot+=a[i];
tot+=d2;
tot+=a[m1]-d1+1;
if (m1==2&&is_l(y1)==366) tot++;
if (tot) tot--;
}
else
{
if (m1^m2)
{
if (is_l(y1)==366) a[2]=29;
Fork(i,m1+1,m2-1) tot+=a[i];
tot+=d2;
tot+=a[m1]-d1+1;
tot--;
}
else tot=d2-d1;
}
cout<<tot<<endl;
return 0;
}