| Task: | Järjestys |
| Sender: | mooc.fi~486604 |
| Submission time: | 2022-01-22 13:25:01 +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<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, acounter,ans;
cin>>n;
vector<string> d; ;
for(int i=0; i<n; i++){
string p;
cin>>p;
d.push_back(p);
}
for(int j=0;j<n; j++){
acounter=0;
ans=0;
for(auto k: d[j]){
if(k=='A'){
acounter++;
}
}
for(int i=0;i<acounter; i++){
if(d[j][i]=='B') ans++;
}
cout<<ans<<endl; }
}