CSES - Datatähti 2022 loppu - Results
Submission details
Task:Järjestys
Sender:mooc.fi~486604
Submission time:2022-01-22 13:25:01 +0200
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails

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; }

}

Test details

Test 1

Verdict: ACCEPTED

input
1000
BBAABBBBAAABABBBAABBAABAAAABBB...

correct output
10
10
20
3
20
...

user output
10
10
20
3
20
...
Truncated