javascript
\nvar removeOuterParentheses = function(S) {\n    let res = \'\',\n        leftNum = 0;\n    for(let i = 0; i < S.length; ++i) {\n        if(S.charAt(i) == \'(\
```\nvar removeOuterParentheses = function(S) {\n    let res = \'\',\n        leftNum = 0;\n    for(let i = 0; i < S.length; ++i) {\n        if(S.charAt(i) == \'(\') {\n            leftNum ++;\n            if(leftNum == 2) {\n                while(leftNum > 0) {\n                    res += S.charAt(i);\n                    S.charAt(++i) == \'(\' ? leftNum ++ : leftNum --;\n                    \n                }\n            }\n        } else\n            leftNum --;\n    }\n    return res;\n};\n```
[]