Simple Java solution
Using HashMap to count occurrences, and HashSet to count letters\n\npublic int maxFreq(String s, int maxLetters, int minSize, int maxSize) {\n    HashMap<String
Using HashMap to count occurrences, and HashSet to count letters\n```\npublic int maxFreq(String s, int maxLetters, int minSize, int maxSize) {\n    HashMap<String, Integer> count = new HashMap<> ();        \n    for(int i = 0; i + minSize <= s.length(); i++) {\n        String temp = s.substring(i, i + minSize);\n        HashSet<Character> letter = new HashSet<>();\n        for(char c: temp.toCharArray()) letter.add(c);\n        if(letter.size() > maxLetters) continue;\n        count.put(temp, count.getOrDefault(temp, 0) + 1);\n    }            \n    int max = 0;\n    for(Map.Entry<String, Integer> entry: count.entrySet()) max = max > entry.getValue()? max : entry.getValue();         \n    return max;\n}\n```
['Java']