Java Solution || Easy to understand
Code
# Code
```java []
class Solution {
    public String clearStars(String s) {
        String ans = "";
        int freq[] = new int[26];
        int j = 0; char x; String substr = "";
        for(int i =0; i<26; i++)
            freq[i] = 0;
        int len = s.length();
        for(int i = 0; i < len; i++){
             if(s.charAt(i) == '*'){
                while(j<26){
                    if(freq[j] != 0){
                        break;
                    }
                    ++j;
                }
                x = (char) (j+'a');
                int idx = ans.lastIndexOf(x);
                ans = (ans.substring(0,idx)).concat(ans.substring(idx+1));
                freq[j]--;
                j = 0;
             }else{
                freq[s.charAt(i)-'a']++;
                ans = ans+s.charAt(i);
             }
        }
        return ans;
        
    }
}
```
['Math', 'String', 'String Matching', 'Java']