#include<bits/stdc++.h> usingnamespace std; intmain(){ int T; scanf("%d", &T); while (T--) { int n; scanf("%d", &n); int a = n / 3 + (n % 3 != 0); int b = n / 3; if (a + 2 * b != n) swap(a, b); printf("%d %d\n", a, b); } return0; }
intmain(){ int T; scanf("%d", &T); while (T--) { scanf("%s", s + 1); n = strlen(s + 1); vector<int> cnt(26); for (int i = 1; i <= n; i++) ++cnt[s[i] - 'a']; int sum = 0, res = 0; for (int i = 0; i < 26; i++) { if (cnt[i] >= 2) ++res; else sum += cnt[i]; } printf("%d\n", res + sum / 2); } return0; }
constint MAX = 2e5+50; int cnt[MAX][6], id[MAX], n; char s[MAX];
intsolve(int x){ sort(id + 1, id + n + 1, [&](int i, int j) { return2 * cnt[i][x] - cnt[i][5] > 2 * cnt[j][x] - cnt[j][5]; }); int sum = 0, res = 0; for (int i = 1; i <= n; i++) { sum += 2 * cnt[id[i]][x] - cnt[id[i]][5]; if (sum <= 0) break; ++res; } return res; }
intmain(){ int T; scanf("%d", &T); while (T--) { scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%s", s + 1); memset(cnt[i], 0, sizeof(cnt[i])); int len = strlen(s + 1); for (int j = 1; j <= len; j++) ++cnt[i][s[j] - 'a']; cnt[i][5] = len; } iota(id, id + n + 5, 0); int res = 0; for (int i = 0; i < 5; i++) res = max(res, solve(i)); printf("%d\n", res); } return0; }