File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments