题解 | #字符串的相邻字符去重#
字符串的相邻字符去重
https://www.nowcoder.com/practice/8c7d55263c624faa8e48a16d92c2e90d
class Solution: def removeDuplicates(self , s: str) -> str: temp = [] for i in s: if temp == [] or temp[-1] != i: temp.append(i) else: temp.pop() return ''.join(temp)