Task: | Järjestys |
Sender: | xyrj |
Submission time: | 2022-01-22 13:10:08 +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 <iostream> #include <algorithm> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { string x; cin >> x; int At = 0; for (char c : x) if (c == 'A') At++; int tulos = 0; for (int j = 0; j < At; j++) if (x.at(j) == 'B') tulos++; cout << tulos << "\n"; } }