Two pointers easy c++ code
\n# Code\ncpp []\n#define FOR(i,a,b)   for(int i = a; i < b.size(); i++)\n#define F0(i,b)      for(int i = 0; i< b.size(); i++)\n#define BE(a)        a.begin(),
\n# Code\n```cpp []\n#define FOR(i,a,b)   for(int i = a; i < b.size(); i++)\n#define F0(i,b)      for(int i = 0; i< b.size(); i++)\n#define BE(a)        a.begin(), a.end()\n#define __S(a)       a.size()\n\ntypedef long long ll;\ntypedef vector<int> vi;\ntypedef vector<vector<int>> vvi;\ntypedef vector <long long> vl;\ntypedef vector<vector<long long>> vvl;\n\n\n\nclass Solution {\npublic:\n    int numberOfSubstrings(string s, int k) {\n        // when one number reaches k, every thing outside is doable => only check inside\n        // two pointers?\n\n        int ans{};\n        map <char,int> mp;\n\n        for (int l = 0, r = 0; r < __S(s); ++r){\n            mp[s[r]]++;\n            if (mp[s[r]] < k) continue;\n\n            // reducing \n            for (;l <= r && mp[s[r]] >= k; ++l){\n                ans+= __S(s) - r;\n                mp[s[l]]--;\n            }\n            //cout << ans << " ";\n        }\n        return ans;\n        \n    }\n};\n```
['C++']