-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1551B1_WonderfulColoring1.cpp
More file actions
71 lines (57 loc) · 1.3 KB
/
1551B1_WonderfulColoring1.cpp
File metadata and controls
71 lines (57 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//* 205234331 May/09/2023 21:01UTC+7 Minh4893IT B1 - Wonderful Coloring - 1 GNU C++14 Accepted 15 ms 100 KB
#include <bits/stdc++.h>
using namespace std;
using sint = signed int;
#define ll long long
#define ull unsigned ll
#define int ll
#define ss stringstream
#define uset unordered_set
#define umap unordered_map
#define vec vector
#define pq priority_queue
#define LLMAX INT64_MAX
#define in cin
#define out cout
#define input in
#define print out
#define GET(var) getline(cin, var)
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FORIR(i, a, n) for (int i = a; i < n; i++)
#define FORI(i, n) FORIR(i, 0, n)
#define FORR(a, n) FORIR(i, a, n)
#define FOR(n) FORIR(i, 0, n)
#define EACH(x, a) for (auto &x : a)
#define IF(cond, t, f) (cond ? t : f)
template <class T>
void OFILE(T finp, T fout)
{
freopen(finp, "r", stdin), freopen(fout, "w", stdout);
}
void solve()
{
string s;
cin >> s;
map<char, int> m;
for (auto c : s)
++m[c];
int cnt1 = 0, cnt2 = 0;
for (auto p : m)
{
cnt1 += p.second == 1;
cnt2 += p.second > 1;
}
cout << cnt2 + cnt1 / 2 << endl;
}
sint main()
{
ios_base::sync_with_stdio(false);
cin.tie();
int t;
cin >> t;
while (t--)
solve();
return 0;
}