Question
String Shift
Zara holds a string T of length M. In one move, she can transform T into a string B of length M-1 by setting each Bi (1 ≤ i < M) to either Ti or Ti+1.
She must repeat this until all characters in the resulting string are identical.
Find the minimum number of moves needed.
She must repeat this until all characters in the resulting string are identical.
Find the minimum number of moves needed.
Input
The first line of the input contains a single integer M.
The second line of the input contains a string T of length M.
Constraints
1 ≤ N ≤ 100
All the characters in T are lowercase english letters.
The second line of the input contains a string T of length M.
Constraints
1 ≤ N ≤ 100
All the characters in T are lowercase english letters.
Output
Print the minimum number of moves required so that string T has all the same characters.
Example
Sample Input
6
packat
Sample Output
2
Explaination
packat -> aakaa -> aaaa
6
packat
Sample Output
2
Explaination
packat -> aakaa -> aaaa