PAT-B1014

#include
#include
int main(){
	int i, j, len1, len2, ans[120]={0},tempweek, temphour, tempm;
	char aa[65], bb[65], cc[65], dd[65];
	char week[7][4]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
	scanf("%s%s%s%s",aa,bb,cc,dd);
	len1=strlen(aa); len2=strlen(bb);
	if(len1>len2)len1=len2;
	 for(i=0;i='A'&&aa[i]<='G'&&aa[i]==bb[i]){tempweek=aa[i]-'A';break;}
	 }
	 for(j=i+1;j='0'&&aa[j]==bb[j]){temphour=aa[j]-'0';break;}
		 if(aa[j]<='N'&&aa[j]>='A'&&aa[j]==bb[j]){temphour=aa[j]-'A'+10;break;}
	   }
	 
	 len1=strlen(cc); len2=strlen(dd);
	 if(len1>len2)len1=len2;
	 for(i=0;i='A'&&cc[i]<='Z'&&cc[i]==dd[i]){tempm=i;break;}
		 if(cc[i]>='a'&&cc[i]<='z'&&cc[i]==dd[i]){tempm=i;break;}
	 }
	
	printf("%s %02d:%02d\n",week[tempweek],temphour,tempm);
return 0;
}

你可能感兴趣的:(PAT乙级)