-
Notifications
You must be signed in to change notification settings - Fork 2
/
ABC.java
46 lines (37 loc) · 1.15 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
42
43
44
45
46
/*
Problem: https://open.kattis.com/problems/abc
Author: Adrian Reithaug
Submitted: June 1st, 2017
Time: 0.09s / 1.00s
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class ABC {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String[] data = reader.readLine().split(" ");
String order = reader.readLine();
int length = data.length;
int[] numbers = new int[length];
for (int i = 0; i < length; i++) {
numbers[i] = Integer.parseInt(data[i]);
}
Arrays.sort(numbers);
for (int i = 0; i < length; i++) {
switch (order.charAt(i)) {
case 'A':
System.out.print(numbers[0]);
break;
case 'B':
System.out.print(numbers[1]);
break;
default:
System.out.print(numbers[2]);
break;
}
System.out.print(" ");
}
}
}