-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_1014.cpp
More file actions
51 lines (49 loc) · 1023 Bytes
/
Copy pathB_1014.cpp
File metadata and controls
51 lines (49 loc) · 1023 Bytes
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
43
44
45
46
47
48
49
50
51
#include <cstdio>
#include <cstring>
int main()
{
char week[7][5] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
char str1[70], str2[70], str3[70],str4[70];
gets(str1);
gets(str2);
gets(str3);
gets(str4);
int len1 = strlen(str1), len2 = strlen(str2), len3 = strlen(str3), len4 = strlen(str4);
int i;
for(i = 0; i < len1 && i < len2; i++)
{
if(str1[i] == str2[i] && str1[i] >= 'A' && str1[i] <= 'G')
{
printf("%s ", week[str1[i] - 'A']);
break;
}
}
for(i++; i < len1 && i < len2; i++)
{
if(str1[i] == str2[i])
{
if(str1[i] >= '0' && str1[i] <= '9')
{
printf("%02d:", str1[i] - '0');
break;
}
else if(str1[i] >= 'A' && str1[i] <= 'N')
{
printf("%02d:", str1[i] - 'A' + 10);
break;
}
}
}
for(int i = 0; i < len3 && i < len4; i++)
{
if(str3[i] == str4[i])
{
if((str3[i] >= 'A' && str3[i] <= 'Z') || (str3[i] >= 'a' &&str3[i]<='z'))
{
printf("%02d",i);
break;
}
}
}
return 0;
}