Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Design and analysis of algorithms / Practicum / Action-119.cpp
blob: 5f3c9da28dedbcb8312b48a583d070329d71f78b (plain) (blame)
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
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int letters[100] = { 0 };

int main() {
	string input;
	getline(cin, input);

	string cap = "BAZINGA", low = "bazinga";
	for (char c : input) {
		for (int i = 0; i < cap.size(); i++) {
			if (c == cap[i] || c == low[i]) {
				letters[i]++;
				break;
			}
		}
	}
	letters[6] = letters[1] = letters[1] / 2;

	int minV = letters[0];
	for (int i = 0; i < cap.size(); i++) {
		if (letters[i] == 0) {
			minV = 0;
			break;
		}
		minV = min(minV, letters[i]);
	}

	cout << minV << endl;
	return 0;
}