Simple C++ Code
If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\npublic:\n
# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        int n = s.size();\n        unordered_map<char, int>countmp;\n        unordered_map<string, int> ocrnc;\n        int left = 0, right = 0, ans = 0;\n        for(int i = 0; i < minSize-1; i++)\n        {\n            countmp[s[i]]++;\n            right++;\n        }\n        while(right<n)\n        {\n            countmp[s[right]]++;\n            int charcnt = right-left+1;\n            //cout<<countmp.size()<<endl;\n            if(countmp.size() <= maxLetters && charcnt >= minSize && charcnt <= maxSize)\n            {\n                ocrnc[s.substr(left,charcnt)]++;\n                //cout<< s.substr(left,charcnt) << endl;\n            }\n            countmp[s[left]]--;\n            //cout<<s[left]<<countmp[s[left]]<<endl;\n            if(countmp[s[left]] == 0)\n            {\n                countmp.erase(s[left]);\n            }\n            left++;\n            right++;\n        }\n        for(auto &[fst,snd] : ocrnc)\n        {\n            //cout << fst << snd << endl;\n            ans = max(ans,snd);\n        }\n        return ans;\n    }\n};\n```
['Sliding Window']