Skip to content

Commit cddd575

Browse files
committed
[BOJ] #9935. 문자열 폭발 / 골드4 / 29분 / 성공
1 parent 113c1b1 commit cddd575

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 최종 제출
2+
import sys
3+
input = sys.stdin.readline
4+
5+
# 초기화
6+
s = input().rstrip() # 전체 문자열
7+
bomb = input().rstrip() # 폭발 문자열
8+
stack = [] # 스택 자료구조
9+
bomb_length = len(bomb) # 폭발문자열의 길이
10+
11+
# 스택만으로 문자열 폭발 탐색 및 폭발 처리
12+
for i in range(len(s)):
13+
stack.append(s[i])
14+
if ''.join(stack[-bomb_length:]) == bomb:
15+
for _ in range(bomb_length):
16+
stack.pop()
17+
18+
# 정답 출력
19+
if stack:
20+
print(''.join(stack))
21+
else:
22+
print('FRULA')

0 commit comments

Comments
 (0)