From 7ce1482f4aa4376adc2de1879d949a9da24b0b69 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 5 Apr 2023 10:36:12 +0300 Subject: [DAAP] Renamed arena to action arena --- .../Practicum/Action-119.cpp | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Year 2/Design and analysis of algorithms/Practicum/Action-119.cpp (limited to 'Year 2/Design and analysis of algorithms/Practicum/Action-119.cpp') diff --git a/Year 2/Design and analysis of algorithms/Practicum/Action-119.cpp b/Year 2/Design and analysis of algorithms/Practicum/Action-119.cpp new file mode 100644 index 0000000..5f3c9da --- /dev/null +++ b/Year 2/Design and analysis of algorithms/Practicum/Action-119.cpp @@ -0,0 +1,35 @@ +#include +#include +#include + +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; +} -- cgit v1.3.1-26-gb76a