-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboj20001.java
More file actions
30 lines (25 loc) · 916 Bytes
/
boj20001.java
File metadata and controls
30 lines (25 loc) · 916 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class boj20001 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Stack<Boolean> stack = new Stack<Boolean>();
while (true) {
String str = br.readLine();
if (str.equals("고무오리")) {
if (stack.size() == 0) {
stack.push(true);
stack.push(true);
} else
stack.pop();
} else if (str.equals("문제")) {
stack.push(true);
} else if (str.equals("고무오리 디버깅 끝")) {
break;
}
}
System.out.println(stack.isEmpty() ? "고무오리야 사랑해" : "힝구");
}
}