재미있는 9935(스택+문자열)
This commit is contained in:
23
zeta_python/completed/9935.py
Normal file
23
zeta_python/completed/9935.py
Normal 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")
|
||||||
Reference in New Issue
Block a user