[C++] Sliding Window Approach.
\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        int i=0,j=0, n=s.length(), ans=0;\n        string te
```\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        int i=0,j=0, n=s.length(), ans=0;\n        string temp;\n        unordered_map<char,int>m;\n        unordered_map<string, int> hash;\n        while(j<n){\n            m[s[j]]++;\n            temp=temp+s[j];\n            while(m.size()>maxLetters || temp.length()>minSize)\n                {\n                    m[s[i]]--;\n                    if(m[s[i]]==0)\n                        m.erase(s[i]);\n                    temp.erase(temp.begin()+0);\n                    i++;\n                }\n            if(m.size()<=maxLetters && temp.length()==minSize ){\n                hash[temp]++;\n            }\n            j++;\n        }\n        for( auto i:hash){\n            cout<<i.first<<endl;\n            ans= max(ans, i.second);\n        }\n        return ans;\n    }\n}\n```
['C', 'Sliding Window']