【Basic Level】
*1014
#include <iostream>
#include <string>
#include <cctype> // isupper() islower() isdigit() isalpha()
using namespace std;
int main()
{
string s[7] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
string s1, s2, s3, s4;
cin >> s1 >> s2 >> s3 >> s4;
int f = 1;
int len0, len1;
len0 = s1.size() > s2.size() ? s2.size() : s1.size();
len1 = s3.size() > s4.size() ? s4.size() : s3.size();
for (int i = 0; i < len0; i++)
{
if ((isupper(s1[i]) || isdigit(s1[i])) && s1[i] == s2[i])
{
if (f)
{
if (s1[i] >= 'A' && 'G' >= s1[i])
{
cout << s[s1[i] - 'A'] << ' ';
f = 0;
}
}
else
{
if (isdigit(s1[i]))
{
cout << 0 << s1[i] << ':';
}
else if (s1[i] <= 'N')
{
cout << s1[i] - 'A' + 10 << ':';
}
break;
}
}
}
for (int i = 0; i < len1; i++)
{
if (s3[i] == s4[i] && isalpha(s3[i]))
{
printf("%02d\n", i);
break;
}
}
return 0;
}