class Solution(object):
    def removeOuterParentheses(self, S):
        """
        :type S: str
        :rtype: str
        """
        mark = 0
        ret = ''
        for i in S:
            if i == '(':
                if mark == 0:
                    mark = 1
                    continue
                mark += 1
            elif i == ')':
                mark -= 1
                        
            if mark > 0:
                ret += i
                
        return ret

相关文章:

  • 2021-07-02
  • 2021-12-16
  • 2021-04-16
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2021-08-29
  • 2022-01-16
猜你喜欢
  • 2021-12-09
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-05-29
相关资源
相似解决方案