Algorithm/Python
[백준 BoJ] 9935 - 문자열폭발
cgy12306
2021. 9. 18. 16:16
#https://www.acmicpc.net/problem/9935
#문자열폭발
import sys
s = sys.stdin.readline()[:-1]
bomb = sys.stdin.readline()[:-1]
stack = []
for ch in s:
stack.append(ch)
if stack[-1] == bomb[-1] and "".join(stack[-len(bomb):]) == bomb:
del stack[-len(bomb):]
answer = "".join(stack)
if answer == "":
print("FRULA")
else:
print(answer)