Question
Color Shift
Zara has M vibrant stones aligned in a row, each colored red, blue, or orange. In one move, she can remove any stone, and the remaining stones slide together to close the gap. Determine the minimum number of moves needed to ensure no two adjacent stones share the same color.
Input
The first line of the input contains a single integer M.
The second line contains a string S, of length M - the ith character defining the color of the ith vibrant stone.
The second line contains a string S, of length M - the ith character defining the color of the ith vibrant stone.
Output
Determine the minimum number of moves needed to ensure no two adjacent stones share the same color.
Example
Sample Input
4
RBBO
Sample Output
1
Explanation
Remove the second stone to obtain pattern "RBO".
4
RBBO
Sample Output
1
Explanation
Remove the second stone to obtain pattern "RBO".