#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int i,j,k,l,n,m1,t,y1,d1,m2,y2,d2,y,d,m;
char c;
//freopen("11219.txt","r",stdin);
//freopen("11219out.txt","w",stdout);
cin>>t;
for(i=1;i<=t;i++)
{
cin>>d1>>c>>m1>>c>>y1;
cin>>d2>>c>>m2>>c>>y2;
if(m2==m1 && d1==d2 && y1==y2)
{
printf("Case #%lld: 0\n",i);
}
else if ((y2>y1) || (y2==y1 && m2>=m1 && d2>=d1))
{
printf("Case #%lld: Invalid birth date\n",i);
}
else if(y2==y1 && m2>m1)
{
printf("Case #%lld: Invalid birth date\n",i);
}
else
{
if(d1>=d2)
{
d=d1-d2;
}
else
{
d1=d1+30;
m1=m1-1;
d=d1-d2;
}
if(m1>=m2)
{
m=m1-m2;
}
else
{
m1=m1+12;
y1=y1-1;
m=m1-m2;
}
y=y1-y2;
if(y>130)
{
printf("Case #%lld: Check birth date\n",i);
}
else
{
printf("Case #%lld: %lld\n",i,y);
}
}
}
return 0;
}
0 comments:
Post a Comment