Easy Python Solution
\n\tdef maxFreq(self, s, maxLetters, minSize, maxSize):\n        """\n        :type s: str\n        :type maxLetters: int\n        :type minSize: int\n        :
\n\tdef maxFreq(self, s, maxLetters, minSize, maxSize):\n        """\n        :type s: str\n        :type maxLetters: int\n        :type minSize: int\n        :type maxSize: int\n        :rtype: int\n        """\n        \n        res = 0\n        \n        visited = collections.defaultdict(int)\n        \n        size = minSize\n        if len(s) < size:\n            return 0\n        else:\n            d = collections.Counter(s[:size])\n            p1 = 0\n            p2 = size-1\n\n            while p2 < len(s):\n                if len(d) <= maxLetters:\n                    visited[s[p1:p2+1]] += 1\n                    res = max(res, visited[s[p1:p2+1]])\n                p1 += 1\n                d[s[p1-1]] -= 1\n                if d[s[p1-1]] == 0:\n                    del d[s[p1-1]]\n                p2 += 1\n                if p2 < len(s):\n                    d[s[p2]] += 1\n                else:\n                    break\n                    \n        \n        return res
['Python']