SIMPLE STACK COMMENTED C++ SOLUTION
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:o(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:o(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\nclass Solution {\npublic:\n    string removeOuterParentheses(string s) {\n        string result;\n        stack<char> stack;\n        int start = 0;  // Start index of a primitive block\n        int n = s.size();\n        for(int i = 0; i <n; i++){\n            if(s[i] == \'(\') {\n                stack.push(\'(\');\n            }else{\n                stack.pop();\n            }\n            // When the stack is empty, we found a complete primitive block\n            if(stack.empty()){\n                // Append all except the outermost parentheses\n                result += s.substr(start + 1, i - start - 1);\n                start = i + 1;  // Update the start for the next primitive block\n            }\n        }\n\n        return result;\n    }\n};\n```
['C++']