forked from daiwb/Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlphabetSoup.cpp
More file actions
49 lines (45 loc) · 932 Bytes
/
AlphabetSoup.cpp
File metadata and controls
49 lines (45 loc) · 932 Bytes
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
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <string>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
string str;
map<char, int> mp;
string hackcup = "HACKERCUP";
void run() {
getline(cin, str);
mp.clear();
REP(i,26) {
mp[char('A' + i)] = 0;
}
REP(i,str.length()) {
mp[str[i]] += 1;
}
int ret = str.length();
REP(i,hackcup.length()) {
if (hackcup[i] == 'C') ret = min(ret, mp[hackcup[i]] / 2);
else ret = min(ret, mp[hackcup[i]]);
}
cout << ret << endl;
}
int main() {
int kase;
cin >> kase;
getline(cin, str);
FOR(k,1,kase) {
cout << "Case #" << k << ": ";
run();
}
return 0;
}