class Solution {
public:
    string removeOuterParentheses(string s) {
        vector<char> res;
        int depth = 0;
        for(char it : s){
            if(it == '('){
                if(depth> 0 ){
                    res.push_back(it);
                }
            depth++;
            }else{
                depth--;
                if(depth>0){
                     res.push_back(it);
                }
            }
        }
        

        return string(res.begin() , res.end());
    }
};

https://leetcode.com/problems/remove-outermost-parentheses/?utm_source=chatgpt.com

https://takeuforward.org/plus/dsa/problems/remove-outermost-parentheses