simple and easy C++ solution 😍❤️‍🔥
if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n\nclass Solution {\npublic:\n    string clearStars(string s) \n    {\n        int cnt = count(s.
# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n```\nclass Solution {\npublic:\n    string clearStars(string s) \n    {\n        int cnt = count(s.begin(), s.end(), \'*\');\n        if(cnt+cnt == s.size()) return "";\n        \n        int n = s.size(), idx;\n        map<char,vector<int>>mp;\n        for(int i=0;i<n;i++)\n        {\n            char ch = s[i];\n            if(ch==\'*\')\n            {\n                for(auto [c, vec]:mp)\n                {\n                    if(vec.size()) \n                    {\n                        idx = vec.back();\n                        mp[c].pop_back();\n                        s[idx] = \'.\';\n                        break;\n                    }\n                }\n            }\n            else mp[ch].push_back(i);\n        }\n\n        string ans;\n        for(auto ch:s)\n        {\n            if(isalpha(ch))\n                ans += ch;\n        }\n        return ans;\n    }\n};\n```
['Hash Table', 'String', 'Sorting', 'C++']