본문 바로가기

백준(BOJ) 풀이

[백준 9935] 문자열 폭발

import sys
s=sys.stdin.readline().rstrip()
bomb=sys.stdin.readline().rstrip()
stack=[]
for i in s:
    stack.append(i)
    if i==bomb[-1] :
        temp=""
        for j in stack[len(bomb)*(-1):]:
            temp+=j
        if temp==bomb:
            del stack[len(bomb)*(-1):]
if len(stack)==0:
    print("FRULA")
else:
    print(*stack, sep="")

'백준(BOJ) 풀이' 카테고리의 다른 글

[백준 3986] 좋은 단어  (0) 2019.11.19
[백준 5218 ] 알파벳 거리  (0) 2019.11.19
[백준 1181] 단어 정렬  (0) 2019.11.15
[백준 11651] 좌표 정렬하기 2  (0) 2019.11.15
[백준 2108] 통계학  (0) 2019.11.15