public String minWindow2(String s, String t) {
        HashMap<Character, Integer> target = new HashMap<>();
        for (int i = 0; i < t.length(); ++i) target.put(t.charAt(i), target.getOrDefault(t.charAt(i), 0) + 1);

        HashMap<Character, Integer> curr = new HashMap<>();
        int l = 0, r = 0, cnt = 0;
        String res = "";
        while (r < s.length()) {
            char chr = s.charAt(r);
            curr.put(chr, curr.getOrDefault(chr, 0) + 1);
            if (target.containsKey(chr) && curr.get(chr) <= target.get(chr)) ++cnt;
            while (cnt == t.length()) {
                if (res.isEmpty() || r - l + 1 < res.length()) res = s.substring(l, r + 1);
                char chl = s.charAt(l);
                int cntl = curr.get(chl) - 1;
                if (target.containsKey(chl) && cntl < target.get(chl)) --cnt;
                curr.put(chl, cntl);
                ++l;
            }
            ++r;
        }
        return res;
    }