1class Solution:2def removeOuterParentheses(self, s: str) -> str:3c = 04res = ""5for i in s:6if i == ")" and c == 1:7c = c - 18elif i == "(" and c == 0:9c = c + 110elif i == "(":11res = res + "("12c = c + 113elif i == ")":14res = res + ")"15c = c - 116return res