-
Notifications
You must be signed in to change notification settings - Fork 7
/
Main.java
70 lines (59 loc) · 1.54 KB
/
Main.java
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package basicLevel1014;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String one = in.nextLine();
String two = in.nextLine();
String three = in.nextLine();
String four = in.nextLine();
in.close();
boolean isDay = false;
boolean isHour = false;
for (int i = 0; i < one.length() && i < two.length(); i++) {
if (one.charAt(i) == two.charAt(i)) {
if (((one.charAt(i) >= 'A' && one.charAt(i) <= 'N') || Character.isDigit(one.charAt(i))) && !isHour
&& isDay) {
isHour = true;
if (one.charAt(i) >= '0' && one.charAt(i) <= '9') {
System.out.print("0" + one.charAt(i));
} else {
System.out.print(one.charAt(i) - 'A' + 10);
}
}
if (one.charAt(i) >= 'A' && one.charAt(i) <= 'G' && !isDay) {
isDay = true;
switch (one.charAt(i)) {
case 'A':
System.out.print("MON ");
break;
case 'B':
System.out.print("TUE ");
break;
case 'C':
System.out.print("WED ");
break;
case 'D':
System.out.print("THU ");
break;
case 'E':
System.out.print("FRI ");
break;
case 'F':
System.out.print("SAT ");
break;
case 'G':
System.out.print("SUN ");
break;
}
}
}
}
for (int i = 0; i < three.length() && i < four.length(); i++) {
if ((Character.isUpperCase(three.charAt(i)) || Character.isLowerCase(three.charAt(i)))
&& three.charAt(i) == four.charAt(i)) {
System.out.printf(":%02d", i);
}
}
}
}