263 传统题

[CF2290B] 固执的画笔 (Stubborn Pen)

时间限制
1000ms
内存限制
256MiB
登顶 / 尝试
0/ 0
难度
2

[CF2290B] 固执的画笔 (Stubborn Pen)

Problem Statement

You have a magic pen that writes in red (R) and blue (B). Initially, the pen is red.

Each time the pen writes a letter, its color automatically flips: after writing in red it turns blue, and after writing in blue it turns red.

Before writing any letter (including before the first letter), you may manually flip the pen's color between red and blue.

Given a string ss of length nn consisting only of R and B, you must write the letters from left to right (si=Rs_i = \text{R} must be written in red, si=Bs_i = \text{B} in blue). Find the minimum number of manual flips needed.

Input

The first line contains a single integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases.

Each test case starts with an integer nn (1≤n≤1001 \le n \le 100), followed by a line containing the string ss of length nn made of R and B.

Output

For each test case, print a single integer — the minimum number of manual flips required.

Example

5
5
BRRBR
1
R
4
RBRB
3
BBB
6
RRBBRB
2
0
0
3
2

Note