c++ sliding window
\nclass Solution\n{\npublic:\n    int count_unique(string s)\n    {\n        unordered_set<char> set(s.begin(), s.end());\n        return set.size();\n    }\n\n
```\nclass Solution\n{\npublic:\n    int count_unique(string s)\n    {\n        unordered_set<char> set(s.begin(), s.end());\n        return set.size();\n    }\n\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize)\n    {\n        if (s.size() < minSize)\n            return 0;\n\n        unordered_map<string, int> mp;\n        int ans = 0;\n\n        for (int i = 0; i + minSize <= s.size(); i++)\n        {\n            string str = s.substr(i, minSize);\n            if (count_unique(str) <= maxLetters)\n            {\n                mp[str]++;\n            }\n\n            ans = max(ans, mp[str]);\n        }\n\n        return ans;\n    }\n};\n```
[]