Task: | Järjestys |
Sender: | Totska |
Submission time: | 2022-01-22 13:11:49 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:23:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (ll j = 0; j < s.size(); j++) ~~^~~~~~~~~~ input/code.cpp:12:11: warning: variable 'ans' set but not used [-Wunused-but-set-variable] ll t, ans; ^~~
Code
#include <bits/stdc++.h> #define ll long long using namespace std; #define fr(x) for(ll i = 0; i < x; i++) int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll t, ans; string s; cin >> t; fr(t) { ans = 0; cin >> s; ll A = 0; for (ll j = 0; j < s.size(); j++) { if (s[j] == 'A') { ++A; } } ll B = 0; for (ll k = 0; k < A; k++) { if (s[k] == 'B') { ++B; } } cout << B << endl; } }