You are given a string word of length n and an integer k, where n is divisible by k.
In a single operation, you can choose two indices i and j such that both i and j are multiples of k, and replace the substring of length k starting at index i with the substring of length k starting at index j.
A string is considered k periodic if every non overlapping substring of length k is identical.
Return the minimum number of operations needed to make word k periodic.
Constraints:
n word.length
k word.length
k divides word.length.
word consists only of lowercase English letters.
You are given a string word of length n and an integer k, where n is divisible by k.
In a single operation, you can choose two indices i and j such that both i and j are multiples of k, and replace the substring of length k starting at index i with the substring of length k starting at index j.
A string is considered k periodic if every non overlapping substring of length k is identical.
Return the minimum number of operations needed to make word k periodic.
Constraints:
n word.length
k word.length
k divides word.length.
word consists only of lowercase English letters.