Easy  | C++ | Sliding Window
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:O(n*26*26)\n\n- Space complexity:O(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int f(string &s,int size,int k){\n        int n=s.size(),ans=0;\n        \n        vector<int> hash(26,0);\n        queue<int> q;\n        for(int i=0;i<size-1 ;i++){\n            hash[s[i]-\'a\']++;\n            if(i>0 && size>1 && abs(s[i-1]-s[i])>2) q.push(i-1);\n        }\n\n        for(int i=size-1;i<n;i++){\n            int check=1;\n            hash[s[i]-\'a\']++;\n            if(i>0 && size>1 && abs(s[i-1]-s[i])>2) q.push(i-1);\n            for(int j=0;j<26;j++){\n                if(hash[j]!=0 && hash[j]!=k) check=0;\n            }\n            if(q.size()>0) check=0;\n            ans += check;\n\n            hash[s[i-size+1]-\'a\']--;\n            if(q.size()>0 && i-size+1==q.front()) q.pop();\n        }\n\n        return ans;\n    }\n    int countCompleteSubstrings(string word, int k) {\n        int ans=0;\n        for(int dif=1;dif<=26;dif++){\n            if(dif*k<=word.size()) ans += f(word,dif*k,k);\n        }\n\n        return ans;\n    }\n};\n```
['String', 'Greedy', 'Queue', 'Sliding Window', 'Hash Function', 'C++']