#include <iostream> #include <string> using namespace std; int main() { string s1, s2, s3, s4; cin >> s1 >> s2 >> s3 >> s4; int ct = 0; for (auto i = s1.begin(), j = s2.begin(); i != s1.end() && j != s2.end(); ++i, ++j){ if (*i == *j&&*i >= 'A'&&*i <= 'G'&&ct == 0){ //第一个相同字符必须是大写字母A到G ct++; switch (*i) { case 'A':cout << "MON "; break; case 'B':cout << "TUE "; break; case 'C':cout << "WED "; break; case 'D':cout << "THU "; break; case 'E':cout << "FRI "; break; case 'F':cout << "SAT "; break; case 'G':cout << "SUN "; break; } continue; } if (*i == *j&&ct==1){ if (*i >= '0'&&*i <= '9'){ cout << '0' << *i - '0' << ':'; break; } else if (*i >= 'A'&&*i <= 'N'){ cout << *i - 'A' + 10 << ':'; break; } } } for (auto i = s3.begin(), j = s4.begin(); i != s3.end() && j != s4.end(); ++i, ++j){ if (*i == *j&&((*i >= 'A'&&*i <= 'Z')||(*i>='a'&&*i<='z'))){ auto it = i - s3.begin(); if (it < 10) cout << '0' << it; else cout << it; break; } } return 0; }
PAT(B)1014. 福尔摩斯的约会 (20)
最新推荐文章于 2023-12-14 15:10:23 发布