알고리즘/백준
[백준] 12904 - A와 B (파이썬)
소갱
2021. 9. 23. 16:29
S = input()
T = input()
start = 0
end = len(T) - 1
k = 0
while True:
if end-start+1 == len(S):
break
if T[end] == 'A':
end -= 1
elif T[end] == 'B':
end -= 1
T = T[start:end+1][::-1]
if T[start:end+1] == S:
print(1)
else:
print(0)