#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a;
    cin >> a;
    map<string,int> ck;
    int ok = 1;
    int A[4] = {13, 13, 13, 13};
    for(int i = 0; i < a.size(); i+= 3) {
        string c = "";
        for(int j = i; j <= i + 2; j++) {
            c += a[j];
        }
        if(ck[c]) {
            ok = 0;
            break;
        }
        ck[c] = 1;
        if(a[i] == 'P') {
            A[0] -= 1;
        }
        else if(a[i] == 'K') {
            A[1] -= 1;
        }
        else if(a[i] == 'H') {
            A[2] -= 1;
        }
        else {
            A[3] -= 1;
        }
    }
    if(!ok) {
        cout << "GRESKA";
    }
    else {
        for(int i = 0; i < 4; i++) {
            cout << A[i] << " ";
        }
    }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |