cgy12306

[백준 BoJ] 9935 - 문자열폭발 본문

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)

'Algorithm > Python' 카테고리의 다른 글

[백준 BoJ] 16918 - 봄버맨  (0) 2021.10.14
[백준 BoJ] 1094 - 막대기  (0) 2021.10.14
[백준 BoJ] 13277 - 큰 수 곱셉  (0) 2021.03.25
Comments