-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathABC.java
30 lines (26 loc) · 850 Bytes
/
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
import java.util.*;
public class ABC {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
ArrayList<Integer> numbers = new ArrayList<>();
while(sc.hasNextInt()){
numbers.add(sc.nextInt());
}
Collections.sort(numbers);
sc.nextLine();
char[] order = sc.nextLine().toCharArray();
for(int i = 0; i < order.length; i++){
switch(order[i]){
case 'A':
System.out.println(numbers.get(0));
break;
case 'B':
System.out.println(numbers.get(1));
break;
case 'C':
System.out.println(numbers.get(2));
break;
}
}
}
}