#K77672. Beautiful String Transformation
Beautiful String Transformation
Beautiful String Transformation
Given a string s of length N, a string is defined as beautiful if no two consecutive characters are the same. Formally, a string s is beautiful if for all indices \( i \) with \( 1 \leq i < N \), we have \( s_i \neq s_{i+1} \). Your task is to compute the minimum number of operations required to transform the given string into a beautiful string. In one operation, you can change any character in the string to any other character.
Note: When a block of consecutive identical characters of length \( L \) occurs, the minimum number of operations needed is \( \lfloor L/2 \rfloor \), because you can change every second character in the block.
inputFormat
The input consists of two lines:
- The first line contains an integer N, the length of the string.
- The second line contains the string s of length N.
outputFormat
Output a single integer, which is the minimum number of operations required to transform the string into a beautiful string. The result should be printed to stdout.
## sample4
aabb
2
</p>