C++ solution using stack
```class Solution {\npublic:\n    string removeOuterParentheses(string S) {\n        string result="";\n        stack st;\n        for(auto ch : S){\n          
```class Solution {\npublic:\n    string removeOuterParentheses(string S) {\n        string result="";\n        stack<char> st;\n        for(auto ch : S){\n            if(ch==\'(\'){\n                if(st.size()>0){\n                    result+=ch;\n                }\n                st.push(ch);\n            }\n            else{\n                if(st.size()>1){\n                    result+=ch;\n                }\n                st.pop();\n            }\n        }\n        return result;\n    }\n};
['Stack']