O(26 * N) Solution || Simple Sliding Window || Beats 100% || C++
Complexity\n- Time complexity:O(26 * n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(26 * n) # Can do it in O(26) space\n Add your space 
# Complexity\n- Time complexity:$$O(26 * n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(26 * n)$$ # Can do it in O(26) space\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int countCompleteSubstrings(string word, int k) {\n        // difference is atmost 2 \n        // return the number of complete substrings of word\n        // sliding window right?\n        // substring length can be k, 2k, 3k, 4k, 5k, ... 26k\n        // Not more than that...\n        // 26 * n right?\n        // 26 time is the size, and check it all the time\n        int n = word.size();\n        int ans = 0;\n        for(int i=1; i * k <= n && i <= 26; i++){\n            int windowSize = i * k;\n            int cnt = 0, freq[26] = {0};\n            int start = 0;\n            for(int j=0; j<n; j++){\n                if(j > 0 && abs(word[j] - word[j-1]) > 2){\n                    cnt = 0;\n                    while(start < j){\n                        freq[word[start] - \'a\']--;\n                        start++;\n                    }\n                }\n                freq[word[j] - \'a\']++;\n                if(freq[word[j] - \'a\'] == 0 || freq[word[j] - \'a\'] == k) cnt--;\n                if(freq[word[j] - \'a\'] == 1 || freq[word[j] - \'a\'] == (k+1)) cnt++;\n                if((j - start + 1) == windowSize){\n                    if(cnt <= 0) ans++;\n                    freq[word[start] - \'a\']--;\n                    if(freq[word[start] - \'a\'] == 0 || freq[word[start] - \'a\'] == k) cnt--;\n                    if(freq[word[start] - \'a\'] == -1 || freq[word[start] - \'a\'] == (k-1)) cnt++;\n                    start++;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']