# 题目

HH:MM”，其中“DAY”是某星期的3字符缩写，即MON表示星期一，TUE表示星期二，WED表示星期三，THU表示星期四，FRI表示星期五，SAT表示星期六，SUN表示星期日。题目输入保证每个测试存在唯一解。

3485djDkxh4hhGE
2984akDfkkkkggEdsb
s&hgsfdk
d&Hyscvnm

THU 14:04

# 代码

## C++解法

```#include <cmath>
#include <iostream>
#include <string>
using namespace std;

const char weekday[7][4] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};

int main() {
cin.tie(0);
cin.sync_with_stdio(false);

string a, b, c, d;
cin >> a >> b >> c >> d;

int len1 = min(a.size(), b.size());
int apos = -1;
int bpos = -1;

for (int i = 0; i < len1; ++i) {
if (apos == -1) {
if (a[i] == b[i] && a[i] >= 'A' && a[i] <= 'G') {
apos = i;
}
} else {
if (a[i] == b[i] && ((a[i] >= 'A' && a[i] <= 'N') ||
(a[i] >= '0' && a[i] <= '9'))) {
if (i != apos) {
bpos = i;
break;
}
}
}
}

int len2 = min(c.size(), d.size());
int cpos = -1;
for (int i = 0; i < len2; ++i) {
if (c[i] == d[i] && ((c[i] >= 'A' && c[i] <= 'Z')||(c[i] >= 'a' && c[i] <= 'z'))) {
cpos = i;
break;
}
}

printf("%s %02d:%02d\n", weekday[a[apos] - 'A'],
(a[bpos] <= '9' ? a[bpos] - '0' : a[bpos] - 'A' + 10), cpos);

return 0;
}
```

## Python解法

```read = []
try:
while 1:
s = input()
if len(s) > 0:
except:
pass

(a, b, c, d) = read

weekday = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]

A = -1
B = -1
C = -1

def checkChar(c, a, b):
if ord(c) >= ord(a) and ord(c) <= ord(b):
return True
else:
return False

length = min(len(a), len(b))
for i in range(length):
if A == -1:
if a[i] == b[i] and checkChar(a[i], 'A', 'G'):
A = i
else:
if a[i] == b[i] and (checkChar(a[i], 'A', 'N') or a[i].isdigit()):
B = i
break

length = min(len(c), len(d))
for i in range(length):
if c[i] == d[i] and c[i].isalpha():
C = i

print("%s %02d:%02d" % (
weekday[ord(a[A]) - ord('A')], ord(a[B]) -
ord('0') if a[B].isdigit() else ord(a[B]) - ord('A') + 10,
C))

```

## Java解法

```import java.io.BufferedReader;

class Main {
public static final String[] weekday = { "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" };

public static void main(String[] args) throws Exception{

int A = -1, B = -1, C = -1;

int len = Math.min(a.length(), b.length());
for (int i = 0; i < len; ++i) {
char ac = a.charAt(i);
char bc = b.charAt(i);
if (A == -1) {
if (ac == bc && ac >= 'A' && ac <= 'G') {
A = i;
}
} else {
if (ac == bc && ((ac >= 'A' && ac <= 'N') || (ac >= '0' && ac <= '9'))) {
B = i;
break;
}
}
}

len = Math.min(c.length(), d.length());
for (int i = 0; i < len; ++i) {
char ac = c.charAt(i);
char bc = d.charAt(i);
if (ac == bc && ((ac >= 'A' && ac <= 'Z') || (ac >= 'a' && ac <= 'z'))) {
C = i;
break;
}
}

System.out.printf("%s %02d:%02d\n", weekday[a.charAt(A) - 'A'],
(a.charAt(B) <= '9' ? a.charAt(B) - '0' : a.charAt(B) - 'A' + 10), C);

}
}
```