1047. 删除字符串中的所有相邻重复项 - 力扣(LeetCode)
class Solution(object):
def removeDuplicates(self, s):
arr=[0]
for i in s:
last=arr.pop()
if i!=last:
arr.append(last)
arr.append(i)
else:
continue
res=''
for i in range(1,len(arr)):
res=res+arr[i]
return res