C++ Solution || Only Array simple approach || O(n)
\n Describe your first thoughts on how to solve this problem. \n\n# Approach--> \n### Just have a array where we will strore the index of stars and alphabet to 
\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach--> \n### Just have a array where we will strore the index of stars and alphabet to be deleted from string as 1 so that at last we can form our resultant string out of it. \n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string clearStars(string s) {\n        vector<int> vis(26,0);\n        string ans="";\n        vector<vector<int>> pos(26);\n        int n=s.size();\n        vector<int> vec(n,0);\n        for(int i=0;i<s.size();i++){\n            if(s[i]==\'*\'){\n                int n=0;\n                for(int c=0;c<26;c++){\n                    if(vis[c]>=1){\n                        n=c;\n                        break;\n                    }\n                }\n                char ch= n +\'a\';\n                int ind=pos[n][pos[n].size()-1];\n                vec[ind]=1;vec[i]=1;\n                vis[n]--;\n                pos[n].pop_back();\n            }\n            else{\n                vis[s[i]-\'a\']++;\n                pos[s[i]-\'a\'].push_back(i);\n            }\n        }\n        for(int i=0;i<n;i++){\n            if(vec[i]==0){\n                ans+=s[i];\n            }\n        }\n        return ans;\n    }\n};\n```
['Array', 'String', 'C++']