재미있는 9935(스택+문자열)

This commit is contained in:
2020-08-12 06:28:18 +09:00
parent 4be6fe4105
commit 811f86e100
2 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
I = input()
R = input()
r = len(R)
before = ""
T = []
for s in I:
if R[-1] == s:
if len(T) < r - 1:
pass
else:
for i in range(r - 1):
if T[1 - r + i] != R[i]:
break
else:
for i in range(r - 1):
T.pop()
continue
T.append(s)
if T:
print("".join(T))
else:
print("FRULA")