Skip to content

Commit ca90421

Browse files
authored
[20250715] BOJ / G4 / 문자열 폭발 / 이준희
1 parent 08e90ba commit ca90421

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
```java
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
import java.util.StringTokenizer;
6+
7+
public class Main {
8+
9+
public static void main(String[] args) throws IOException {
10+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11+
StringTokenizer st;
12+
13+
String str = br.readLine();
14+
String bomb = br.readLine();
15+
16+
StringBuilder sb = new StringBuilder();
17+
18+
int blen = bomb.length();
19+
20+
for (char c : str.toCharArray()) {
21+
sb.append(c);
22+
23+
if (sb.length() >= blen) {
24+
if (sb.substring(sb.length() - blen).equals(bomb)) {
25+
sb.delete(sb.length() - blen, sb.length());
26+
}
27+
}
28+
}
29+
30+
31+
if (sb.length() != 0) {
32+
System.out.println(sb.toString());
33+
} else {
34+
System.out.println("FRULA");
35+
}
36+
}
37+
38+
39+
}
40+
41+
```

0 commit comments

Comments
 (0)