BOJ - 9935 - 문자열 폭발

Updated:

def solution():
    string = str(input())
    bomb = str(input())

    s = []
    length = len(bomb)

    for ch in string:
        s.append(ch)

        if ch == bomb[-1] and bomb == "".join(s[-length:]):
            for i in range(length):
                s.pop()
    if s:
        print(''.join(s))
    else:
        print("FRULA")

solution()

https://www.acmicpc.net/problem/9935

Categories:

Updated:

Leave a comment