We will call a string -String if it consists of distinct characters. For example, if is 3 then “abc”, “aabbcc”, “xyaaaa” are -String whereas “abcd”, “ddhhnnggs” are not.
In one move, you can replace any one character of the given string by any other lower case English alphabet. Your task is to find the minimum number of moves required to make a string -String.
It is guaranteed that you can always convert the given string into a -string by performing zero or more moves.
The first line of the input contains two integers (), denoting the size of the string and (), denoting the number of distinct characters required.
Output the minimum number of moves required to make the given string a -String.
Input | Output |
---|---|
4 3 abcd | 1 |
Input | Output |
---|---|
5 3 abcdd | 1 |