注意
DAY:扫描第一对相同的大写字母A~G
HH: 在扫描到DAY之后,再扫描第一对是数字和大写字母A~N的字符
MM:扫描相同英文字符
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <unordered_map>
#include <algorithm>
using namespace std;
int main(){
string s1, s2, s3, s4;
unordered_map<char, string> mp;
mp['A'] ="MON";
mp['B'] ="TUE";
mp['C'] ="WED";
mp['D'] ="THU";
mp['E'] ="FRI";
mp['F'] ="SAT";
mp['G'] ="SUN";
cin>>s1>>s2>>s3>>s4;
char week, hour;
int minute;
int cnt = 0;
bool tag = false;
for(int i = 0; i < s1.size() && i < s2.size(); i++){
if(s1[i] >= 'A' && s1[i] <= 'G' && s1[i] == s2[i] && !tag){
week = s1[i];
tag = true;
continue;
}
if(tag && s1[i] == s2[i] && (isdigit(s1[i])|| s1[i] >= 'A' && s1[i] <= 'N')){
hour = s1[i];
break;
}
}
for(int i = 0; i < s3.size() && i < s4.size(); i++){
if(s3[i] == s4[i]&& isalpha(s3[i])) {
minute = i;
break;
}
}
int h = isdigit(hour) ? hour - '0' : hour - 'A' + 10;
cout<<mp[week]<<" ";
printf("%02d:%02d\n", h, minute);
return 0;
}