[C++] || No stack || Beginner friendly || Fastest
you can shorter this code i have written in easiet way so that everyone can understand \uD83D\uDE0A\n\n1. Make a variable count \n2. increase count everytime we
*you can shorter this code i have written in easiet way so that everyone can understand \uD83D\uDE0A*\n```\n1. Make a variable count \n2. increase count everytime we get  \'(\' \n3. decrease count everytime we get \')\'\n4. if count == 0 and we get \')\' this means there is no opening bracket dont do anywork else store\ncharacters\n5. if extra opening are found we can handle it after this work by removing from last and\n decreasing count\n```\n**CODE**\n```\nclass Solution {\npublic:\n    string minRemoveToMakeValid(string s) {\n        int n = s.size();\n        int cnt = 0;\n        string ans = "";\n        for(int i = 0 ; i < n ; i++){\n\t\t\n\t\t// if we get opening bracket increase count as we get same number of \n\t\t// closing bracket in a valid \n            if(s[i] == \'(\'){\n                cnt++;\n                ans += s[i];\n            }\n\t\t\t\n\t\t// we get closing bracket now there can be 2 cases if count is 0 which means there is no \n\t\t// opening found then dont do any work\n            else if(s[i] == \')\'){\n                if(cnt == 0){\n                    \n                }\n\t\t\t\t\n\t\t// 2nd case when cnt > 0 then decrease count and add char to ans\n                else{\n                    cnt--;\n                    ans += s[i];\n                }\n            }\n\t\t\t\n\t// else lowercase found\n            else{\n                ans += s[i];\n            }\n        }\n    \n\t\n\t\n\t// this is case when count > 0 which means only opening found\n\t\n\t// like s = "abc((" then after upper loop we get ans = "abc((" and cnt == 2 now we have to do some work to \n\t// remove opening brackets according to count\n        if(cnt > 0){\n            for(int i = ans.size()-1 ; i >= 0 ; i--){\n                if(ans[i] == \'(\' and cnt > 0){\n                    cnt--;\n                }\n                else{\n                    res += ans[i];\n                }\n            }\n            reverse(res.begin(),res.end());\n            return res;\n        }\n        return ans;\n    }\n};\n```\n\n*just code no comments*\n```\nclass Solution {\npublic:\n    string minRemoveToMakeValid(string s) {\n        int n = s.size();\n        int cnt = 0;\n        string ans = "";\n        for(int i = 0 ; i < n ; i++){\n            if(s[i] == \'(\'){\n                cnt++;\n                ans += s[i];\n            }\n            else if(s[i] == \')\'){\n                if(cnt == 0){\n                    \n                }\n                else{\n                    cnt--;\n                    ans += s[i];\n                }\n            }\n            else{\n                ans += s[i];\n            }\n        }\n        \n        if(cnt > 0){\n            for(int i = ans.size()-1 ; i >= 0 ; i--){\n                if(ans[i] == \'(\' and cnt > 0){\n                    cnt--;\n                }\n                else{\n                    res += ans[i];\n                }\n            }\n            reverse(res.begin(),res.end());\n            return res;\n        }\n        return ans;\n    }\n};\n```
['C']