Task: | Järjestys |
Sender: | MojoLake |
Submission time: | 2022-01-22 13:04:31 +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:27:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = ama; i < s.length(); ++i){ ~~^~~~~~~~~~~~ input/code.cpp:26:13: warning: unused variable 'counta' [-Wunused-variable] int counta = 0; ^~~~~~
Code
#include <bits/stdc++.h> #define ll long long #define mp make_pair #define pb push_back #define F first #define S second using namespace std; const int N = (int)1e5; const ll inf = (ll)1e18; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while(t--){ string s; cin >> s; int ama=0, amb=0; for(char c : s){ if(c=='A')ama++; else amb++; } ll ans = 0; int counta = 0; for(int i = ama; i < s.length(); ++i){ if(s[i]=='A')ans++; } cout << ans << "\n"; } return 0; }