easy code in c++
\n# Code\n\nclass Solution {\npublic:\n    string minRemoveToMakeValid(string s) {\n        stack<char> st;\n        int n=s.size();\n        string ans="";\n  
\n# Code\n```\nclass Solution {\npublic:\n    string minRemoveToMakeValid(string s) {\n        stack<char> st;\n        int n=s.size();\n        string ans="";\n        for(int i=0;i<n;i++) {\n            if(s[i] == \'(\') {\n                st.push(s[i]);\n            }\n            else if(s[i] == \')\') {\n               if( !st.empty() ) {\n                    st.pop();\n               }\n               else {\n                   continue;\n               }\n            }\n            ans.push_back(s[i]);\n        }\n        int i=ans.size()-1;\n        while(!st.empty() && i>=0) {\n            if(ans[i] == \'(\') {\n                ans.erase(ans.begin()+i);\n                st.pop();\n            }\n            i--;\n        }\n        return ans;\n    }\n};\n```
['C++']