#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param s string字符串 
# @return string字符串
#
class Solution:
    def removeDuplicates(self , s: str) -> str:
        # write code here
        stack = []#栈
        for c in s:
            if len(stack)>0 and c==stack[-1]:#要消除的情况,消除后退出本次循环
                stack.pop()
                continue
            stack += [c]#如果本次没消除,则将本次的字符加入栈中
        return ''.join(stack)#栈中的元素合并后返回