| Task: | Järjestys |
| Sender: | Juho |
| Submission time: | 2022-01-22 13:09:21 +0200 |
| Language: | C++ (C++11) |
| 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:14:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j=0;j<s.size();j++){
~^~~~~~~~~Code
#include <bits/stdc++.h>
using namespace std;
int n, a, b;
string s;
int main(){
cin>>n;
for(int i=0;i<n;i++){
cin>>s;
a=0;
b=0;
for(int j=0;j<s.size();j++){
if(s[j]=='A'){
a++;
}
}
for(int j=0;j<a;j++){
if(s[j]=='B'){
b++;
}
}
cout<<b<<"\n";
}
}
