Problem: You have a stripe of checkered paper of length . Each cell is either white or black.
What is the minimum number of cells that must be recolored from white to black in order to have a segment of consecutive black cells on the stripe?
If the input data is such that a segment of consecutive black cells already exists, then print 0.
Input Format: The first line contains an integer () — the number of test cases.
Next, descriptions of test cases follow.
The first line of the input contains two integers and (). The second line consists of the letters 'W' (white) and 'B' (black). The line length is .
It is guaranteed that the sum of values does not exceed .
Output Format: For each of test cases print an integer — the minimum number of cells that need to be repainted from white to black in order to have a segment of consecutive black cells.
Note: In the first test case, ="BBWBW" and . It is enough to recolor and get ="BBBBW". This string contains a segment of length consisting of the letters 'B'.
In the second test case of the example ="BBWBW" and . It is enough to recolor and and get ="BBBBB". This string contains a segment of length consisting of the letters 'B'.
In the third test case of the example ="BBWBW" and . The string already contains a segment of length consisting of the letters 'B'.