Another C++ Solution
\nint maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        bitset<26> bit;\n        unordered_map<string, int> M;\n        int result = 0;\n\n
```\nint maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        bitset<26> bit;\n        unordered_map<string, int> M;\n        int result = 0;\n\n        for (int i = 0; i <= s.length() - minSize; i++)\n        {\n            string str = s.substr(i, minSize);\n\n            for (char& character: str)\n                bit.set(character - \'a\');\n\n            if (bit.count() <= maxLetters)\n            {\n                M[str]++;\n                result = max(result, M[str]);\n            }\n        \n            bit.reset();\n        }\n\n        return result;\n    }\n```
[]