Task: | Järjestys |
Sender: | EeliH |
Submission time: | 2022-01-22 13:12:37 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
Code
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; string _; getline(cin, _); for(int q = 0; q < t; q++) { string merkit; getline(cin, merkit); int len = merkit.length(); int endi = len - 1; int maara = 0; for(int i = 0; i < len; i++) { if(merkit[i] == 'B') { while(merkit[endi] == 'B') { if(endi == i) { goto next; } endi--; } maara++; endi--; } if(endi == i) { goto next; } } next: cout << maara << endl; } }