Lottery
InterviewTime limit1sMemory limit128 MB
Change as few letters of the given A, B, or C string as possible so no two neighbors match.
Problem
A lottery company runs a numbers game called Letter Game. A game ticket has positions, and on each position you mark exactly one of three letters: A, B, or C. The figure below shows an example ticket for .

The winning string is produced by a drawing machine that holds balls: balls marked A, marked B, and marked C. The machine has holes arranged in a row, and during the draw exactly one ball is pulled into each hole. Reading the letters on the drawn balls from left to right gives a string of letters, which is the result of the draw. A ticket marked with exactly this string wins the grand prize. The figure below shows a draw for which the ticket above would win.

The draw, however, is not entirely fair: two balls of the same kind (the same letter) repel each other and never end up in adjacent holes, so the arrangement shown in the figure above is in fact impossible. As a result, in every possible draw no two consecutive letters are the same.
You have already marked a string of letters on your ticket. You want to change your string so that no two consecutive letters are equal, changing as few positions as possible; each position you change may be set to any of the letters A, B, or C. Determine the minimum number of letters you have to change.
Input
The first line contains an integer (). The second line contains a string of characters, each equal to A, B, or C. This string contains at least one pair of adjacent equal letters.
Output
Print a single positive integer: the minimum number of letters that must be changed so that no two adjacent letters in the string are equal.