input: from collections import Counter
  def steps_to_make_k_periodic(word: str, k: int) -> int:
      """
      Given a string word of length n and an integer k such that k is a divisor of n.
  
      In each step, you can choose any two indices i and j that are multiples of k, then replace the substring of length k starting at i with the substring of length k starting at j. That is, you replace the substring word[i..i + k - 1] with the substring word[j..j + k - 1].
  
      Return the minimum number of steps required to transform word into a k-periodic string.
  
      A string is k-periodic if there exists a string s of length k such that word can be produced by repeating s any number of times. For instance, if word == “ababab”, then word is 2-periodic for s = "ab".
  
      Examples:
      >>> word = "leetcodeleet", k = 4
      1
      >>> word = "leetcoleet", k = 2
      3
  
      Constraints:
      1 <= n == word.length <= 10^5
      1 <= k <= word.length
      k divides word.length.
      word consists only of lowercase English letters.
      """
output:     
      n = len(word)
      segments = n // k
      steps = 0
      for i in range(k):
          freq = Counter()
          for j in range(i, n, k):
              freq[word[j]] += 1
          most_common_count = max(freq.values())
          steps += segments - most_common_count
      return steps
  