Easy c++ solution ||
Intuition\n Describe your first thoughts on how to solve this problem. \n- Data Structure\n\n        map> mp;\n- use\n\n        for storing the index of charact
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Data Structure\n\n        map<char,vector<int>> mp;\n- use\n\n        for storing the index of characters and as \n        map will sort according to key therefore \n        mp.begin() will have the smallest character \n        and to get lexi.. smallest string we have to\n        remove the rightmost char outoff the character\n        which are available to remove which is stored in\n        the vector\'s last index .\n- Therefore we have everything to proceed .\n- Steps:\n\n        Initialization: Create a map mp to store\n        characters and their indices.\n- Processing:\n            \n        Iterate through s.\n        - If the character is \'*\':\n            Mark it as \'1\'.\n            If mp is not empty,\n                 remove the smallest character \n                 present at mp.begin()\n                 and mark it as \'1\' in string. And\n                 remember to remove the index which\n                 is removed from string.\n        - Otherwise,\n                 add the character and \n                 its index to mp.\n- Construct Result: \n\n        Build the result string by excluding \n        characters marked as \'1\'.\n\n- Example:\n\n        For input "ab*c*d*e", the processing\n         steps will transform it to "11111d1e",\n         and the final result will be "de".\n\n\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    O(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(N)\n\n# Code\n```\nclass Solution {\npublic:\n    string clearStars(string s) {\n        int n = s.size();\n        map<char,vector<int>> mp;\n        for(int i = 0;i < s.size(); i++){\n            if(s[i] == \'*\'){\n                s[i] = \'1\';\n                if(mp.size() == 0)continue;\n                \n                auto it = mp.begin();\n                char ch = mp.begin()->first;\n                \n                \n                int idx = mp.begin()->second[mp.begin()->second.size()-1];\n                mp.begin()->second.pop_back();\n                if(mp.begin()->second.size() == 0)mp.erase(ch);\n                s[idx] = \'1\';\n            }else{\n                mp[s[i]].push_back(i);\n            }\n        }\n        string ans = "";\n        for(auto x : s){\n            if(x != \'1\')\n                ans += x;\n        }\n        return ans;\n\n    }\n};\n```
['String', 'Ordered Map', 'C++']