-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabc.java
41 lines (40 loc) · 1.27 KB
/
abc.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
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String ans = "";
int x = sc.nextInt();
int y = sc.nextInt();
int z = sc.nextInt();
int min = x < y ? x < z ? x
: z
: y < z ? y
: z;
int max = x > y ? x > z ? x
: z
: y > z ? y
: z;
int med = (min == x && max == y) || (min == y) && (max == x) ? z
: (min == y && max == z) || (min == z && max == y) ? x
: y;
String temp = sc.next();
for (int i = 0; i < 3; i++) {
char s = temp.charAt(i);
switch (s) {
case 'A':
ans += Integer.toString(min);
break;
case 'B':
ans += Integer.toString(med);
break;
case 'C':
ans += Integer.toString(max);
break;
}
if (i <= 2) {
ans += " ";
} else {}
}
System.out.println(ans);
}
}