29 lines
525 B
C++
29 lines
525 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int t;
|
|
cin >> t;
|
|
for (int i = 0; i < t; i++) {
|
|
size_t n;
|
|
cin >> n;
|
|
|
|
std::string buffer;
|
|
cin >> buffer;
|
|
|
|
int first_b = -1;
|
|
int last_b = -1;
|
|
|
|
for (int j = 0; j < n; j++) {
|
|
if (buffer[j] == 'B') {
|
|
if (first_b == -1) {
|
|
first_b = j;
|
|
}
|
|
last_b = j;
|
|
}
|
|
}
|
|
|
|
cout << last_b - first_b + 1 << endl;
|
|
}
|
|
}
|