1014 福尔摩斯的约会 (20 分)
注:字符串处理
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main ()
{
char a[88],b[88],c[88],d[88];
int i,j;
char week[7][4]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
scanf ("%s %s %s %s",a,b,c,d);
for (i=0;i<min(strlen(a),strlen(b));i++)
{
if (a[i]==b[i]&&a[i]>='A'&&a[i]<='G')
{
printf ("%s ",week[a[i]-'A']);
break;
}
}
for (j=i+1;j<min(strlen(a),strlen(b));j++)
{
if (a[j]==b[j])
{
if (a[j]>='0'&&a[j]<='9')
{
printf ("0%d:",a[j]-'0');
break;
}
else if (a[j]>='A'&&a[j]<='N')
{
printf ("%d:",a[j]-'A'+10);
break;
}
}
}
for (i=0;i<min(strlen(c),strlen(d));i++)
{
if (c[i]==d[i]&&((c[i]>='A'&&c[i]<='Z')||(c[i]>='a'&&c[i]<='z')))
{
printf ("%02d",i);
}
}
return 0;
}