#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
string s; cin >> s;
int n = s.size();
int c = n / 3;
set<string> us;
int p = 13, k = 13, h = 13, t = 13;
for (int i = 0; i < n; i += 3) {
string curr; curr += s[i]; curr += s[i + 1]; curr += s[i + 2];
us.insert(curr);
if (s[i] == 'P') p--;
else if (s[i] == 'K') k--;
else if (s[i] == 'H') h--;
else t--;
}
if (us.size() < c) cout << "GRESKA";
else cout << p << " " << k << " " << h << " " << t;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |