Skip to content

Commit

Permalink
Unique question codeforces round 923
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanashii76 authored Feb 6, 2024
1 parent 9b8b56d commit 3e7f697
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Codeforces/contest1927/A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <bits/stdc++.h>

using namespace std;

int how_many(string c, int index) {

int count = 0, start = 0, end = 0;

for(int i = 0; i < index; ++i) {

if(c[i] == 'B' && count == 0) {
count++;
start = i;
}

if(c[i] == 'B' && count != 0)
end = i;

}

return end-start+1;

}


int main(void){

int n, index;
string c;

cin >> n;

for(int i = 0; i < n; ++i) {
cin >> index >> c;
cout << how_many(c, index) << endl;
}

}

0 comments on commit 3e7f697

Please sign in to comment.