Task: | Järjestys |
Sender: | intoo |
Submission time: | 2022-01-22 13:05:05 +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:16:7: warning: unused variable 'n' [-Wunused-variable] int n = s.size(); ^
Code
#include <iostream> #include <vector> using namespace std; using ll = long long; int main() { //ios_base::sync_with_stdio(false); //cin.tie(nullptr); int t; cin >> t; while (t --> 0) { string s; cin >> s; int n = s.size(); int as = 0; for (char c : s) as += c == 'A'; int v = 0; for (int i = 0; i < as; ++i) { v += s[i] != 'A'; } cout << v << endl; } }