✅✅ Simple and Easy
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n\n    boolean isfreq(int[] alp, int k){\n\n        // int[] alp=new int[26];\n\n        // for(char c:w.toCharArray()){\n        //     alp[c-\'a\']++;\n        // }\n\n        for(int i=0;i<26;++i){\n            if(alp[i]!=0 && alp[i]!=k)\n                return false;\n        }\n        return true;\n    }\n\n    boolean isadj(String w){\n        for(int i=0;i<w.length()-1;++i){\n            if(Math.abs(w.charAt(i)-w.charAt(i+1)) > 2)\n                return false;\n        }\n        return true;\n    }\n    int ans=0;\n\n    void sol(String w, int k){\n        \n        int totUniChar=new HashSet<>(List.of(w.split(""))).size();\n\n        for(int uniChar=1;uniChar<=totUniChar;++uniChar){\n            int window=uniChar * k;\n            if(window>w.length())\n                break;\n            int[] alp=new int[26];\n            for(int i=0;i<window;++i){\n                alp[w.charAt(i)-\'a\']++;\n            }\n            // for(int i:alp)\n            //     System.out.print(i+" ");\n\n            if(isadj(w.substring(0,window)) & isfreq(alp,k)){\n                ans++;\n            }\n            \n            for(int start=1;start<=w.length()-window;++start){\n                alp[w.charAt(start-1)-\'a\']--;\n                alp[w.charAt(start+window-1)-\'a\']++;\n                if(isfreq(alp,k) && isadj(w.substring(start,start+window))){\n                    // System.out.println(w.substring(start,start+window));\n                    ans++;\n                }\n            }\n        }\n    }\n\n    public int countCompleteSubstrings(String word, int k) {\n        \n        sol(word,k);\n        return ans;\n    }\n}\n```
['Java']