From 3e7f697c4e33a890bb69b91893e2e94e65f836cb Mon Sep 17 00:00:00 2001 From: "Paulo H. Lamounier" <53798700+Nanashii76@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:33:29 -0300 Subject: [PATCH] Unique question codeforces round 923 --- Codeforces/contest1927/A.cpp | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Codeforces/contest1927/A.cpp diff --git a/Codeforces/contest1927/A.cpp b/Codeforces/contest1927/A.cpp new file mode 100644 index 0000000..bc068ee --- /dev/null +++ b/Codeforces/contest1927/A.cpp @@ -0,0 +1,38 @@ +#include + +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; + } + +} \ No newline at end of file