Time limit
2s
Memory limit
128 MB
Sejun is a biologist, so he often works with DNA strings. One day, he became tired of looking at a long DNA string and wanted to express it in a simpler periodic form.
For a string of length L, a positive integer P is a period length if, for every integer i with 0≤i≤L−P−1, the character at position i is the same as the character at position i+P. For example, CATCATC, CATCAT, ACTAC, and ACT all have period length 3.
Given a DNA string, change as few characters as possible so that it becomes a periodic string whose period length is at most M. Find the minimum number of characters that must be changed.
The first line contains M. The value of M is at most the length of the string.
The second line contains the DNA string. The string consists only of A, C, G, and T, and its length is at most 3000.
Print the minimum number of characters that must be changed.