#P8739. [蓝桥杯 2020 国 C] 重复字符串
[蓝桥杯 2020 国 C] 重复字符串
Problem Description
If a string can be obtained exactly by repeating some string times, then we call a -times repeated string. For example, abcabcabc can be seen as repeating abc for times, so abcabcabc is a -times repeated string.
Similarly, aaaaaa is a -times repeated string, a -times repeated string, and also a -times repeated string.
Now given a string , please compute the minimum number of characters that need to be modified so that becomes a -times repeated string.
Input Format
The first line contains an integer .
The second line contains a string consisting only of lowercase letters.
Output Format
Output an integer as the answer. If cannot be modified into a -times repeated string, output .
2
aabbaa
2
Hint
Constraints: , . Here denotes the length of .
Lanqiao Cup 2020 National Contest Group C, Problem G.
Translated by ChatGPT 5