WITH THE HELP OF SLIDING WINDOWS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\nint solve(int start,int end,string& word,int k){\n    int result=0;\n    for(int uni=1;uni<=26&&uni*k<=end-start+1;uni++){\n    vector<int>count(26,0);\n    int good=0;\n    int i=start;\n    int length=uni*k;\n    for(int j=start;j<=end;j++){\n        count[word[j]-\'a\']++;\n        if(count[word[j]-\'a\']==k){\n            good++;\n        }\n        else if(count[word[j]-\'a\']>k){\n            good--;\n        }\n        if(j-i+1>length){\n            if(count[word[i]-\'a\']==k){\n                good--;\n            }\n            else if(count[word[i]-\'a\']>k){\n                good++;\n            }\n            count[word[i]-\'a\']--;\n            i++;\n        }\n if(good==uni){\n        result++;\n    }\n    }\n\n    }\n    return result;\n}\n    int countCompleteSubstrings(string word, int k) {\n        int result=0;\n        int n=word.size();\n        //int j=0;\n        int last=0;\n        for(int i=1;i<=n;i++){\n            if(i==n||abs(word[i]-word[i-1])>2){\n                result+=solve(last,i-1,word,k);\n                 last=i;\n            }\n        }\n        return result;\n    }\n};\n```
['C++']