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

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

Test details

Test 1

Verdict: ACCEPTED

input
1000
BBAABBBBAAABABBBAABBAABAAAABBB...

correct output
10
10
20
3
20
...

user output
10
10
20
3
20
...
Truncated