身分証明書年月日の抽出


#include 
#include 
#include 
int main()
{
	int year=0,month=0,day=0;
	int i,j=1;
	char Id[19];
	int age;
	scanf("%s",&Id);
	for(i=9;i>5;i--) {
	year=year+(Id[i]-'0')*j;
	j*=10;
}
	j=1;
	for(i=11;i>9;i--) {
	month=month+(Id[i]-'0')*j;
	j*=10;
	}
	j=1;
	for( i=13;i>11;i--) {
	day=day+(Id[i]-'0')*j;
	j*=10;
	}
	age=2018-year;
	if(age>=18&&age<=25)
        {
            printf("Yes!
"); } if((Id[16]-'0')%2==0) { printf("%d ,
",age); } else printf("%d ,
",age); return 0; }