JAVA SOLUTION || USING 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)$$ -->\n\n# Code\n```\nclass Solution {\n    public String clearStars(String s) {\n        if(s.indexOf(\'*\') == -1) return s;\n        \n        char a[] = s.toCharArray();\n        \n        Stack<Integer> stk = new Stack<>();\n        Stack<Integer> stk1 = new Stack<>();\n        \n        for(int i = 0; i < s.length(); i++) {\n            char c = s.charAt(i);\n            \n            if(c == \'*\') {\n                \n                a[stk.pop()] = \' \';\n                \n                continue;\n            }\n            \n            while(!stk.isEmpty() && s.charAt(stk.peek()) < c ) {\n                stk1.push(stk.pop());\n            }\n            \n            stk.push(i);\n            \n            while(!stk1.isEmpty()) {\n                stk.push(stk1.pop());\n            }\n        }\n        \n        StringBuilder sb = new StringBuilder("");\n        \n        for(char c : a) {\n            if(c != \' \' && c != \'*\') {\n                sb.append(c);\n            }\n        }\n        \n        return sb.toString();\n    }\n}\n```
['Stack', 'Java']