11219

#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
	int t,kase=1;
	int dd,mm,YY,dd1,mm1,yy1;
	int y;
	cin>>t;

	while(t--)
	{
		scanf("%d/%d/%d",&dd,&mm,&YY);//current date
		scanf("%d/%d/%d",&dd1,&mm1,&yy1);//birth date

		y=YY-yy1;
		if(mm-mm1<0)
		{
			y--;
		}
		else if(mm==mm1)
		{
			if(dd<dd1)
			y--;
		}
		if(y<0)
		cout<<"Case #"<<kase++<<": Invalid birth date\n";
		else if(y>130)
		cout<<"Case #"<<kase++<<": Check birth date\n";
		else
		cout<<"Case #"<<kase++<<": "<<y<<"\n";

	}

	return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *