動機
紀錄
Sol
def solution(S):
stk = []
for c in S:
if stk and stk[-1] == c:
stk.pop()
else:
stk.append(c)
return ''.join(stk)
紀錄
def solution(S):
stk = []
for c in S:
if stk and stk[-1] == c:
stk.pop()
else:
stk.append(c)
return ''.join(stk)