-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathABC.java
More file actions
29 lines (28 loc) · 700 Bytes
/
ABC.java
File metadata and controls
29 lines (28 loc) · 700 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
import java.util.*;
public class ABC{
public static void main(String []args){
Scanner scan=new Scanner(System.in);
String []num=scan.nextLine().split(" ");
int first=Integer.parseInt(num[0]);
int second=Integer.parseInt(num[1]);
int third=Integer.parseInt(num[2]);
int arr[]=new int[3];
arr[0]=first;
arr[1]=second;
arr[2]=third;
Arrays.sort(arr);
String desired[]=scan.nextLine().split("");
for(int i=0;i<desired.length;i++){
if(desired[i].equals("A")){
System.out.print(arr[0]+" ");
}
else if(desired[i].equals("B")){
System.out.print(arr[1]+" ");
}
else{
System.out.print(arr[2]+" ");
}
}
System.out.println();
}
}