-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBattle.java
41 lines (31 loc) · 1.13 KB
/
Battle.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;
import java.util.Collections;
import java.util.ArrayList;
public class Battle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
boolean complete = false;
for(int i =0; i < input.length();)
{
if(i <= input.length()-3 && input.charAt(i) != input.charAt(i+1) && input.charAt(i) != input.charAt(i+2)
&& input.charAt(i+1) != input.charAt(i+2))
{
System.out.print("C");
i +=3 ;
}else{
if(input.charAt(i) == 'R')
{
System.out.print("S");
}else if(input.charAt(i) == 'B')
{
System.out.print("K");
}else if(input.charAt(i) == 'L')
{
System.out.print("H");
}
i++;
}
}
}
}