easy way 🔥|| without stack
\nclass Solution {\npublic:\n    string removeOuterParentheses(string s) {\n        int cnt = 0;\n        string res;\n\n        for (auto c: s) {\n            
```\nclass Solution {\npublic:\n    string removeOuterParentheses(string s) {\n        int cnt = 0;\n        string res;\n\n        for (auto c: s) {\n            if (cnt == 0 && c == \'(\') cnt--;\n            else if (cnt == -1 && c == \')\') cnt++;\n            else {\n                res.push_back(c);\n                if (c == \'(\') cnt--;\n                else cnt++;\n            }\n        }\n\n        return res;\n    }\n};\n```\n---\n**compact code**\n\n---\n```\nclass Solution {\npublic:\n    string removeOuterParentheses(string s) {\n        int cnt = 0;\n        string res;\n\n        for (auto c: s) {\n            if (c == \'(\' && cnt++ > 0 ) res.push_back(c);\n            if (c == \')\' && cnt-- > 1 ) res.push_back(c);\n        }\n\n        return res;\n    }\n};\n```
['C++']