7325: CodeChef DIFFCONSEC - Different Consecutive Characters
[Creator : ]
Description
Chef has a binary string $S$ of length $N$. Chef can perform the following operation on $S$:
- Insert any character (0 or 1) at any position in S.
Input
The first line contains a single integer $T$ — the number of test cases. Then the test cases follow.
The first line of each test case contains an integer N — the length of the binary string S.
The second line of each test case contains a binary string S of length N containing 0s and 1s only.
The first line of each test case contains an integer N — the length of the binary string S.
The second line of each test case contains a binary string S of length N containing 0s and 1s only.
Output
For each test case, output on a new line the minimum number of operations Chef needs to perform so that no two consecutive characters are same in S.
Constraints
$1≤T≤100$
$1 \le N \le 10000$
$1 \le N \le 10000$
Sample 1 Input
3
2
11
4
0101
5
00100
Sample 1 Output
1
0
2
Test case 1: We can perform the following operations: $11 \rightarrow 1\underline{0}1$.
Test case 2: We do not need to perform any operations.
Test case 3: We can perform the following operations: $00100 \rightarrow 0\underline{1}0100 \rightarrow 01010\underline{1}0$.
Test case 2: We do not need to perform any operations.
Test case 3: We can perform the following operations: $00100 \rightarrow 0\underline{1}0100 \rightarrow 01010\underline{1}0$.