Task: | ABC-poisto |
Sender: | mango_lassi |
Submission time: | 2020-10-17 19:01:53 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.01 s | 2 | details |
Code
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve() { string str; cin >> str; int n = str.size(); vector<int> cou(3, 0); for (auto c : str) cou[c - 'A'] += 1; int mx = max(cou[0], max(cou[1], cou[2])); cout << min(2 * (n - mx), n) << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; for (int ti = 0; ti < t; ++ti) solve(); }