[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 of length consisting only of R and B, you must write the letters from left to right ( must be written in red, in blue). Find the minimum number of manual flips needed.
Input
The first line contains a single integer () — the number of test cases.
Each test case starts with an integer (), followed by a line containing the string of length 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
- Constraints: , .
- Source: Codeforces 2290B · Stubborn Pen