Simple C++ Solution | minheap and map of stack
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nPlease upvote if the solution helps \n# Code\n```\nclass Solution {\npublic:\n    string clearStars(string s) {\n        \n        priority_queue<char, vector<char>, greater<char>> pq;\n        \n        unordered_map<char, stack<int>> mp;\n        \n        unordered_set<int> indexes;\n        \n        for(int i=0;i<s.size();i++){\n            if(s[i]!=\'*\'){\n\n                mp[s[i]].push(i);\n                pq.push(s[i]);\n            }else{\n                \n                auto val=pq.top();\n                pq.pop();\n                int index=mp[val].top();\n                mp[val].pop();\n            \n                \n                indexes.insert(i);\n                indexes.insert(index);\n                \n            }\n        }\n        \n        string res="";\n        \n        for(int i=0;i<s.size();i++){\n            if(indexes.find(i)!=indexes.end())\n                continue;\n            \n            res+=s[i];\n        }\n        \n        return res;\n        \n    }\n};\n```
['C++']