CSES - Putka Open 2020 – 3/5 - Results
Submission details
Task:ABC-poisto
Sender:Metabolix
Submission time:2020-10-16 19:23:46
Language:CPython3
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED42
#2ACCEPTED58
Test results
testverdicttimegroup
#1ACCEPTED0.02 s1, 2details
#2ACCEPTED0.03 s2details

Code

#!/usr/bin/python3

t = int(input())
for _ in range(t):
	s = input()
	a = sum(1 for c in s if c == "A")
	b = sum(1 for c in s if c == "B")
	c = sum(1 for c in s if c == "C")
	isoin = max([a, b, c])
	toiset = len(s) - isoin
	if toiset <= isoin:
		print(len(s) - (isoin - toiset))
	else:
		print(len(s) - (len(s) % 2))

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
100
CABC
BABCCBCA
CBBCBBAC
ACAA
...

correct output
4
8
8
2
2
...

user output
4
8
8
2
2
...

Test 2

Group: 2

Verdict: ACCEPTED

input
100
CCAAACBCBBCCACBBBCCACCCBABBCAB...

correct output
48
4
4
96
70
...

user output
48
4
4
96
70
...