-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4593.java
More file actions
50 lines (45 loc) · 1017 Bytes
/
4593.java
File metadata and controls
50 lines (45 loc) · 1017 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 4593. Rock, Paper, Scissors
// 2019.08.18
// 문자열 처리, 영어 문제
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
String first = br.readLine();
String second = br.readLine();
if (first.equals("E") && second.equals("E")) {
break;
}
int p1 = 0;
int p2 = 0;
for (int i = 0; i < first.length(); i++) {
switch (first.charAt(i)) {
case 'R':
if (second.charAt(i) == 'S') {
p1++;
} else if (second.charAt(i) == 'P') {
p2++;
}
break;
case 'S':
if (second.charAt(i) == 'P') {
p1++;
} else if (second.charAt(i) == 'R') {
p2++;
}
break;
case 'P':
if (second.charAt(i) == 'R') {
p1++;
} else if (second.charAt(i) == 'S') {
p2++;
}
break;
}
}
System.out.println("P1: " + p1);
System.out.println("P2: " + p2);
}
}
}