Description
As is known to all, we have two formats to denote a specific date: MM/DD/YY or YY/MM/DD. We supposed the years discussed below are years in 20YY.

Now you are given a string representing the date. If there is only one possible date it can fit in with format of “MM/DD/YY” or “YY/MM/DD”, output the date in the format of “month date, year” (as can be seen in the second sample). Otherwise, output the days between the two different dates it might be.

Input
The first line contains an integer T
T
representing the number of test cases.
In each test case, a string ”AA/BB/CC” is given in one line.
It is guaranteed that there is at least one legal date it can fit in with format of ”MM/DD/YY” or ”YY/MM/DD”.
1≤T≤5
1≤T≤5

Output
For each test case, if there are two different possible dates, output an integer in one line representing the days between the two possible dates. In the other case, output the exact date in one line.

Sample Input

Raw

3
02/07/19
19/02/07
07/02/19

Sample Output

Raw

6047
February 7, 2019
4516

Hint
In the first sample, the date might be July 19th, 2002 or February 7th, 2019. The number of days between the two dates are 6047 days.
As for the second sample, the only possible date is February 7th, 2019.
There are 12 months in a year and they are January, February, March, April, May, June, July, August, September, October, November and December.
Also, please note that there are 29 days in February in a leap year while 28 days in nonleap year.

重在细节!!!!!!

AC代码

#include <stdio.h>
#include <string.h>
int T,aa,bb,cc,flag1,flag2;
int p[13]={29,31,28,31,30,31,30,31,31,30,31,30,31};
int pdrn(int yy)//闰年判断 
{if((yy%4==0&&yy%100!=0)||yy%400==0)return 1;
 else return 0;
}
int gs1()//判断 是否 符合 格式 1 MM/DD/YY 
{ int yy=cc+2000;p[2]=28;
    if(pdrn(yy))p[2]=p[0];
    if(aa>12||aa==0)return 0;
    if(bb>p[aa]||bb==0)return 0;
    return 1;
}
int gs2()//判断 是否 符合 格式 2 YY/MM/DD 
{ int yy=aa+2000;p[2]=28;
    if(pdrn(yy))p[2]=p[0];
    if(bb>12||bb==0)return 0;
    if(cc>p[bb]||cc==0)return 0;
    return 1;
}
int tsc()//求天数差 =(起始年到目标日期-起始年到起始日期) 
{      
    int y1=aa+2000,m1=bb,d1=cc,y2=cc+2000,m2=aa,d2=bb,ans=0,i,sum=0;
      //y1 m1 d1 为起始日期 y2 m2 d2 为目标日期 
    if(aa>cc)y1=cc+2000,m1=aa,d1=bb,y2=aa+2000,m2=bb,d2=cc;//较大的日期作为目标日期 
    p[2]=28;//默认 2月为平年 
    if(pdrn(y1))p[2]=29;//若为闰年 附值为29 
    for(i=1;i<m1;i++)//计算 起始年(XXXX年1月1日) 到 起始日期的天数 
        sum+=p[i];
        sum+=d1;
    while(y1<y2)//以年为单位在增加 
    {
        if(pdrn(y1))ans+=366;
        else ans+=365;
        y1++;
    }
    p[2]=28;
    if(pdrn(y2))p[2]=p[0]; 
    for(i=1;i<m2;i++)//以月为单位增加 
        ans+=p[i];
        ans+=d2;//天数增加 
        return ans-sum;//(起始年到目标日期-起始年到起始日期) 
}
int main()
{  char yue[12][20]={"January","February","March","April","May","June","July","August","September","October","November","December"};
    scanf("%d",&T);
    while(T--)
    {   
        scanf("%d/%d/%d",&aa,&bb,&cc);
        flag1=gs1();
         flag2=gs2();
        if(flag1&&flag2)
        {
         if(aa==bb&&bb==cc)printf("%s %d, %d\n",yue[aa-1],bb,2000+cc);
         else 
        {int ans=tsc();if(ans<0)ans=-ans;//01/03/01同一年的情况可能为负 
            printf("%d\n",ans);
        }
        }else
        {   if(flag2)printf("%s %d, %d\n",yue[bb-1],cc,2000+aa);
            else printf("%s %d, %d\n",yue[aa-1],bb,2000+cc);
        }
    }
    return 0;
}