Sliding Window Easiest Solution !!
\n# Code\n\nclass Solution {\npublic:\n    int countCompleteSubstrings(string word, int k) {\n        int n = word.size();\n        int ans = 0;\n        if(k =
\n# Code\n```\nclass Solution {\npublic:\n    int countCompleteSubstrings(string word, int k) {\n        int n = word.size();\n        int ans = 0;\n        if(k == 1) {\n            ans += n;\n        }\n\n        //No of unique characters : mul\n        for(int mul=1;mul<=26;mul++) {\n\n            //No of unique characters : mul\n            //Frequency of each character : k\n            //Window Length: mul*k\n            int len = mul*k;\n            if(len > n) {\n                continue;\n            }\n            int i = 0;\n            int j = 0;\n            map<char,int> mp;\n            while(i < n && j < n) {\n                if(i == j) {\n                    mp[word[j]]++;\n                    j++;\n                }\n                else {\n                    if(abs(word[j]-word[j-1]) <= 2) {\n                        mp[word[j]]++;\n                        if(j-i+1 == len) {\n                            int flag = 1;\n                            for(auto x:mp) {\n                                if(x.second != k) {\n                                    flag = 0;\n                                }\n                            }          \n                            if(mp.size() == mul  &&  flag == 1) {\n                                //cout<<i<<" "<<j<<endl;\n                                ans++;\n                                mp[word[i]]--;\n                                if(mp[word[i]] == 0) {\n                                    mp.erase(word[i]);\n                                }\n                                i++;\n                                j++;\n                            }\n                            else {\n                                mp[word[i]]--;\n                                if(mp[word[i]] == 0) {\n                                    mp.erase(word[i]);\n                                }\n                                i++;\n                                j++;\n                            }\n                        }\n                        else {\n                            j++;   \n                        }\n                    }\n                    else {\n                        i = j;\n                        mp.clear();\n                    }\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']