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

Code

t = int(input())
for _ in range(t):
    a = bytearray(str(input()), 'ascii')
    l = len(a)
    n = a.count(65)
    if 2*n >= l:
        answer = a[n:].count(65)
    else:
        answer = a[:n].count(66)
    print(answer)

Test details

Test 1

Verdict: ACCEPTED

input
1000
BBAABBBBAAABABBBAABBAABAAAABBB...

correct output
10
10
20
3
20
...

user output
10
10
20
3
20
...
Truncated