Javascript Stack oriented solution
var removeOuterParentheses = function(S) {\n\n    let stack = [];\n    let result = \'\';\n    for (const s of S) {\n       if( s === \'(\') {\n           if (s
var removeOuterParentheses = function(S) {\n\n    let stack = [];\n    let result = \'\';\n    for (const s of S) {\n       if( s === \'(\') {\n           if (stack.length) {\n               result+=s;\n           }\n           stack.push(s);\n       } else {\n           stack.pop();\n           if (stack.length) {\n               result+=s;\n           }\n       }\n    }\n\n    return result;\n};
['JavaScript']