Skip to content

Commit 46aaf50

Browse files
authored
Merge pull request #838 from AlgorithmWithGod/JHLEE325
[20250907] BOJ / G5 / A와 B / 이준희
2 parents a7cbbd3 + 36da0a1 commit 46aaf50

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
```java
2+
import java.io.*;
3+
import java.util.*;
4+
5+
public class Main {
6+
public static void main(String[] args) throws IOException {
7+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8+
StringTokenizer st;
9+
String s = br.readLine();
10+
String t = br.readLine();
11+
12+
StringBuilder sb = new StringBuilder();
13+
sb.append(t);
14+
15+
while (s.length() < sb.length()) {
16+
char lastChar = sb.charAt(sb.length() - 1);
17+
18+
sb.deleteCharAt(sb.length() - 1);
19+
20+
if (lastChar == 'B') {
21+
sb.reverse();
22+
}
23+
}
24+
25+
if (s.equals(sb.toString())) {
26+
System.out.println(1);
27+
} else {
28+
System.out.println(0);
29+
}
30+
}
31+
}
32+
33+
```

0 commit comments

Comments
 (0)