根据题意模拟
注意枚举的长度要按二者最短的长度枚举
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
string s1,s2,s3,s4;
cin>>s1>>s2>>s3>>s4;
int flag=0;
string w[7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
int n1=s1.length(),n2=s2.length(),n3=s3.length(),n4=s4.length();
int len1;
if(n1>n2) len1=n2;
else len1=n1;
for(int i=0;i<len1;i++)
{
if(s1[i]==s2[i]&&(s1[i]>=65&&s1[i]<=71)&&flag==0)
{
cout<<w[s1[i]-65]<<' ';
flag=1;
i++;
}
if(flag==1&&s1[i]==s2[i])
{
if(s1[i]>='0'&&s1[i]<='9')
{
cout<<"0"<<s1[i]-'0'<<":";
break;
}
if(s1[i]>='A'&&s1[i]<='N')
{
cout<<s1[i]-'A'+10<<":";
break;
}
}
}
int len2;
if(n3>n4) len2=n4;
else len2=n3;
for(int i=0;i<len2;i++)
{
if((s3[i]==s4[i])&&(s3[i]>=65&&s3[i]<=122)&&(s4[i]>=65&&s4[i]<=122))
{
if(i>=0&&i<=9)
{
cout<<'0'<<i;
break;
}
else
{
cout<<i;
break;
}
}
}
return 0;
}