#arc140a. [arc140_a]Right String
[arc140_a]Right String
Problem Statement
For a string consisting of lowercase English letters, consider the question below, and let be the answer.
Find the number of different strings obtained by performing the following operation any number of times: delete the first character from and append it to the end.
You are given a string of length consisting of lowercase English letters. You can perform the operation below at most times (possibly zero).
- Choose a character of and change it to any lowercase English letter.
Find the minimum possible value of after your operations.
Constraints
- is a string of length consisting of lowercase English letters.
- and are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4 1
abac
Sample Output 1
2
If you change the fourth character c
to b
in the first operation, you get abab
, with .
cannot be made or less in one or fewer operations, so the answer is .
Sample Input 2
10 0
aaaaaaaaaa
Sample Output 2
1
Sample Input 3
6 1
abcaba
Sample Output 3
3