EZZZYYYY.... CODE.... ⭐
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        StringBuilder ans = new StringBuilder();\n\n        int t = 0;\n\n        for (int i = 0; i < s.length(); i++) {\n//            com.push(s.charAt(i))\n            ans.append(s.charAt(i));\n            if (s.charAt(i) != \'*\')t++;\n            else t--;\n        }\n\n        if(t == 0)return "";\n\n        for (int i = 0; i < ans.length(); i++) {\n            if(ans.charAt(i) == \'*\'){\n                ans.deleteCharAt(i);\n                char temp = \'~\';\n                int inTemp = 0;\n                for (int j = --i; j > -1; j--) {\n                    if ((int) ans.charAt(j) < (int) temp){\n                        inTemp = j;\n                        temp = ans.charAt(j);\n                    }\n                }\n                i--;\n                ans.deleteCharAt(inTemp);\n            }\n        }\n\n        return ans.toString();\n    }\n}\n```
['Java']