-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1014.c
42 lines (41 loc) · 1.22 KB
/
1014.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
char str[4][61];
char date[][5] = {"MON ", "TUE ", "WED ", "THU ", "FRI ", "SAT ", "SUN "};
scanf("%s %s %s %s", str[0], str[1], str[2], str[3]);
int cnt = 0;
for(int i = 0; str[0][i] && str[0][i]; i++){
if(str[0][i] == str[1][i]){
if(cnt == 0){
if (str[0][i] >= 'A' && str[0][i] <= 'G'){
cnt++;
int day = (int)(str[0][i] - 'A');
printf("%s", date[day]);
}
continue;
}
if(cnt == 1){
if(str[0][i] >= 'A' && str[0][i] <= 'N'){
int hour = (int)(str[0][i] - 'A' + 10);
printf("%02d:", hour);
break;
}
if(str[0][i] >= '0' && str[0][i] <= '9'){
int hour = (int)(str[0][i] - '0');
printf("%02d:", hour);
break;
}
}
}
}
for(int i = 0; str[2][i] && str[3][i]; i++){
if(str[2][i] == str[3][i] && isalpha(str[2][i])){
printf("%02d", i);
break;
}
}
return 0;
}