#include <stdio.h>

//获取公历年初至某整月的天数
int year_sumday(int year,int month)
{
    int sum=0;
    int rui[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    int ping[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    int ruiflag=0;
    if((year%4==0 &&year%100!=0) || year%400==0) ruiflag=1;
    for(int index=0;index<month-1;index++)
    {
        if(ruiflag==1) sum+=rui[index];else sum+=ping[index];
    }
    return sum;
}
//获取公历年的天数
int year_alldays(int year)
{
    if((year%4==0 && year%100!=0) || year%400==0) return 366; else return 365;
}

//获取从公历1975年1月1日至当前日期的总天数
int get_g_alldays(int year,int month,int day)
{
    int i=1975,days=0;
    while(i<year)
    {
        days+=year_alldays(i);
        i++;
    }
    int days2=year_sumday(year,month);
    return days+days2+day;
}
bool y_check(int year,int month,int day)
{
    if(year>2100 || year<1975) return false;
    if (month>12) return false;
    if (day>31) return false;
    return true;
}

int main()
{
	char* week[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
	int winit=3;   //初始化星期三  1975.01.01
	int days=0;
	int syear,smonth,sday;
	int _week;
_input:
	printf("请输入阳历年月日例如2012,11,30==");
	scanf("%d,%d,%d",&syear,&smonth,&sday);
	if(y_check(syear,smonth,sday)==false) 
	{
		printf("输入日期有错误,请重新输入\n");
		goto _input;
	}
	days=get_g_alldays(syear,smonth,sday);
    _week=(days % 7 + winit-1)%7;
	printf("%d\n",_week);
	printf("%s\n",week[_week]);
    return 0;
}