[Greedy] [Sliding Window] [O(n*26)]
Complexity\n- Time complexity:O(n*26)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(n) \n Add your space complexity here, e.g. O(n) \n\n# 
# Complexity\n- Time complexity:$$O(n*26)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(n)$$ \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool check(vector<int> & freq, int j, int k) {\n        int count = 0;\n        for(int i = 0; i < 26; i++) {\n            if(freq[i] == 0) {\n                continue;\n            }\n            if(freq[i] != k) {\n                return false;\n            }\n            count++;\n        }\n        if(count > j) return false;\n        return true;\n    }\n    int countCompleteSubstrings(string word, int limit) {\n        string s;\n        s.push_back(word[0]);\n        vector<string>words;\n        for(int i = 1; i < word.length(); i++) {\n            if(abs(word[i] - s[s.length()-1]) <= 2) {\n                s+=word[i];\n            }\n            else{\n                words.push_back(s);\n                s=word[i];\n            }\n        }\n        if(s.length()) {\n            words.push_back(s);\n        }\n        int count = 0;\n        for(int i = 0; i < words.size(); i++) {\n            string s = words[i];\n            for(int j = 1; j <= 26; j++) {\n                if(j*limit <= s.length()) {\n                    int length = min((j*limit), (int)s.length());\n                    vector<int> freq(26, 0);\n                    for(int k = 0; k < length; k++) {\n                        freq[s[k]-\'a\']++;\n                    }\n                    if(check(freq, j, limit)) {\n                        count++;\n                    }\n                    int z = s.length() - length;\n                    for(int k = 1; k <= s.length() - length; k++) {\n                        freq[s[k-1]-\'a\']--;\n                        freq[s[k+length-1]-\'a\']++;\n                        if(check(freq, j , limit)) {\n                            count++;\n                        }\n                    }\n                }\n            }\n        }\n        return count;\n    }\n};\n\n// 0 1 2 3 \n```
['C++']