____Shivam Gupta_____
\n\n# Code\ncpp []\nclass Solution {\npublic:\n    static bool comp(pair<char, int> a, pair<char, int> b) {\n        if (a.first == b.first)\n            return
\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    static bool comp(pair<char, int> a, pair<char, int> b) {\n        if (a.first == b.first)\n            return a.second < b.second;\n        else\n            return a.first > b.first;\n    }\n    string clearStars(string s) {\n        priority_queue<pair<char, int>, vector<pair<char, int>>, decltype(&comp)> pq(comp);\n        string ans;\n        int n = s.size();\n        for (int i = 0; i < n; i++) {\n            if (s[i] != \'*\') {\n                pq.push({s[i], i});\n            } else {\n                if (!pq.empty()) {\n                    int idx = pq.top().second;\n                    pq.pop();\n                    s[idx] = s[i] = \'#\';\n                }\n            }\n        }\n        for (char c : s) {\n            if (c != \'#\') {\n                ans.push_back(c);\n            }\n        }\n        return ans;\n    }\n};\n\n```
['C++']