C++ solution using One stack and One queue.
\nclass Solution {\npublic:\n    string removeOuterParentheses(string S) {\n        stack<char> open;\n        queue<char> primitive;\n        string output;\n 
```\nclass Solution {\npublic:\n    string removeOuterParentheses(string S) {\n        stack<char> open;\n        queue<char> primitive;\n        string output;\n        for(int i=0; i<S.length(); i++) {\n            primitive.push(S[i]);\n            if(S[i] == \'(\') {\n                open.push(S[i]);\n            }\n            else {\n                open.pop();\n                if(open.empty()) {\n                    primitive.pop();\n                    while(!primitive.empty()) {\n                        output.push_back(primitive.front());\n                        primitive.pop();\n                    }\n                    output.pop_back();\n                }\n            }\n        }\n        return output;\n    }\n};\n```\n\nStack stores the opening brackets. Once the stack is empty, we found one primitive. Primitives are stored in queue. We remove the outer brackets and store in output.
['C', 'C++']