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

Code

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        string x;
        cin >> x;

        int At = 0;
        for (char c : x)
            if (c == 'A')
                At++;

        int tulos = 0;

        for (int j = 0; j < At; j++)
            if (x.at(j) == 'B')
                tulos++;

        cout << tulos << "\n";
    }
}

Test details

Test 1

Verdict: ACCEPTED

input
1000
BBAABBBBAAABABBBAABBAABAAAABBB...

correct output
10
10
20
3
20
...

user output
10
10
20
3
20
...
Truncated