Python simple solution with explanation
\nclass Solution:\n    def removeOuterParentheses(self, S: str) -> str:\n        result =  \'\'\n        depth = 0\n        for index in range(0, len(S) - 1):\n
```\nclass Solution:\n    def removeOuterParentheses(self, S: str) -> str:\n        result =  \'\'\n        depth = 0\n        for index in range(0, len(S) - 1):\n            char = S[index]\n            if depth != 0:\n                result += char\n            if char == "(" and S[index + 1] == "(":\n                depth += 1\n            elif char == ")" and S[index + 1] == ")":\n                depth -= 1\n        return result\n```\n\nThe **depth** variable represents how many levels into the primitive parentheses the current parenthesis is in. A depth value of zero represents a paraenteses belonging to a set primitive parentheses.\n\n## Logic\n- Subsequent opening parentheses will result in depth increasing by one\n- Subsequent closing parentheses will result in depth decreasing by one\n-  A switch from closing to opening parenthesis \'(\' -> \')\' will not change the depth value\n-  If the depth value is not 0 (i.e. not an outer parenthesis) add the current parenthesis to the result\n-  The last parenthesis in the string S will always be a closing parenthesis [i.e. ")" ]\n\n\n### Example 1\n| Depth Value | 0 | 1 | 2 | 2 | 1 | 0 |\n|:-----------:|:-:|---|---|---|---|---|\n| char in S      | ( | ( | ( | ) | ) | ) |\n\n\n### Example 2\n| Depth Value | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 |\n|:-----------:|:-:|---|---|---|---|---|---|---|\n| char in S  | ( | ( | ) | ) | ( | ( | ) | ) |\n
['Python', 'Python3']