Task: | ABC-poisto |
Sender: | Metabolix |
Submission time: | 2020-10-16 19:23:46 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 42 |
#2 | ACCEPTED | 58 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.02 s | 1, 2 | details |
#2 | ACCEPTED | 0.03 s | 2 | details |
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))