beats 100% || with hint and intuition || c++
Intuition\nHINT: think about 26 lower case letters and exactly k letters in a substring and try to lower down the constraints and then apply brute force \n\n# C
# Intuition\nHINT: think about 26 lower case letters and exactly k letters in a substring and try to lower down the constraints and then apply brute force \n\n# Code\n```\nclass Solution {\npublic:\n    bool check(vector<int>&v,int k){\n        int cnt=0;\n        for(int i=0;i<26;i++){\n            if(v[i]!=0){\n                if(v[i]!=k){\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n    int count(string &curr,int k,int k1){\n        if(curr.size()<k){\n            return 0;\n        }\n        int ans=0;\n        vector<int> v(26);\n        for(int i=0;i<k;i++){\n            v[curr[i]-\'a\']++;\n        }\n        int i=0;\n        int j=k;\n        if(check(v,k1)){\n            ans++;\n        }\n        while(j!=curr.size()){\n            v[curr[j]-\'a\']++;\n            v[curr[i]-\'a\']--;\n            i++;\n            j++;\n            if(check(v,k1)){\n                ans++;\n            }\n        }\n        return ans;\n    }\n    int countCompleteSubstrings(string word, int k) {\n        string s="";\n        s+=word[0];\n        vector<string> v;\n        vector<int> freq(26);\n        freq[word[0]-\'a\']++;\n        for(int i=1;i<word.size();i++){\n            freq[word[i]-\'a\']++;\n            if(abs(word[i]-word[i-1])<=2){\n                s+=word[i];\n            }\n            else{\n                v.push_back(s);\n                s=word[i];\n            }\n        }\n        v.push_back(s);\n        int cnt=0;\n        for(auto it:freq){\n            if(it==0){\n                cnt++;\n            }\n        }\n        int left=26-cnt;\n        int ans=0;\n        for(auto it:v){\n            string curr=it;\n            for(int i=1;i<=left;i++){\n                ans+=(count(curr,k*i,k));\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']