Faster than 65%, Sliding Window, O(n)
Intuition\nSum up the resilt for all substrings with length equals to k, k * 2, k * 3, ...\n\n# Approach\nAt first split the input string into separate strings 
# Intuition\nSum up the resilt for all substrings with length equals to k, k * 2, k * 3, ...\n\n# Approach\nAt first split the input string into separate strings (with `Math.Abs(word[i] - word[i - 1]) <= 2`):\n```\nvar words = GetWordsInLongestSubsequence(word);\n```\nThen calculate the result:\n```\nvar rs = 0;\nfor (int i = 0; i < words.Count; i++)\n{\n    rs += CountCompleteSubstringsAux(words[i], k);\n}\nreturn rs;\n```\nIn the method `CountCompleteSubstringsAux` at first find the maximum total number of different letters:\n```\nvar lettersCount = GetLettersCount(word, k);\n```\nThen for each `i <= lettersCount` calculate the result:\n```\nfor (int i = 1; i <= lettersCount; i++)\n{\n    var len = Math.Min(i, word.Length / k) * k;\n    ...\n    for (int j = 1; j < word.Length + 1 - len; j++)\n    {\n        ...\n        if (IsComplete(dic, k)) rs++;\n    }\n}\n```\n# Complexity\n- Time complexity:\n$$O(n)$$, where n is the length of `word`\n\n- Space complexity:\n$$O(n)$$, where n is the length of `word`\n\n# Code\n```\npublic class Solution {\n    public int CountCompleteSubstrings(string word, int k) {\n        var words = GetWordsInLongestSubsequence(word);\n        var rs = 0;\n        for (int i = 0; i < words.Count; i++)\n        {\n            rs += CountCompleteSubstringsAux(words[i], k);\n        }\n        return rs;\n    }\n    private int CountCompleteSubstringsAux(string word, int k)\n    {\n        var lettersCount = GetLettersCount(word, k);\n        var rs = 0;\n        for (int i = 1; i <= lettersCount; i++)\n        {\n            var len = Math.Min(i, word.Length / k) * k;\n            var dic = InitDictionary(len, word);\n            if (IsComplete(dic, k)) rs++;\n            for (int j = 1; j < word.Length + 1 - len; j++)\n            {\n                if (!dic.ContainsKey(word[j + len - 1]))\n                {\n                    dic.Add(word[j + len - 1], 1);\n                }\n                else\n                {\n                    dic[word[j + len - 1]]++;\n                }\n                if (dic[word[j - 1]] == 1)\n                {\n                    dic.Remove(word[j - 1]);\n                }\n                else\n                {\n                    dic[word[j - 1]]--;\n                }\n                if (IsComplete(dic, k)) rs++;\n            }\n        }\n        return rs;\n    }\n    private bool IsComplete(Dictionary<char, int> dic, int k)\n    {\n        foreach (var item in dic)\n        {\n            if (item.Value != k) return false;\n        }\n        return true;\n    }\n    private Dictionary<char, int> InitDictionary(int len, string word)\n    {\n        var rs = new Dictionary<char, int>();\n        for (int i = 0; i < len; i++)\n        {\n            if (!rs.ContainsKey(word[i]))\n            {\n                rs.Add(word[i], 1);\n            }\n            else\n            {\n                rs[word[i]]++;\n            }\n        }\n        return rs;\n    }\n    private int GetLettersCount(string word, int k)\n    {\n        var set = new HashSet<char>();\n        for (int i = 0; i < word.Length; i++)\n        {\n            if (!set.Contains(word[i])) set.Add(word[i]);\n        }\n        return Math.Min(set.Count, word.Length / k);\n    }\n    private List<string> GetWordsInLongestSubsequence(string word)\n    {\n        var index = 0;\n        var len = 1;\n        var rs = new List<string>();\n        for (int i = 1; i < word.Length; i++)\n        {\n            if (Math.Abs(word[i] - word[i - 1]) <= 2)\n            {\n                len++;\n            }\n            else\n            {\n                rs.Add(word.Substring(index, len));\n                index = i;\n                len = 1;\n            }\n        }\n        rs.Add(word.Substring(index, len));\n        return rs;\n    }\n}\n```
['Sliding Window', 'C#']