P6529 [COCI 2015/2016 #1] KARTE

Description

Here is a pile of cards, but unfortunately it seems they are not complete. You need to find how many cards are missing for each suit. If there are duplicate playing cards, output `GRESKA`.

Input Format

You will read a string $s$, where every three characters represent one playing card. For each playing card: - The first character is the suit, represented by `P`, `K`, `H`, `T`, and the output order is also this order. - The next two characters are the rank of the card. A one-digit rank will be padded with a leading zero.

Output Format

If there are duplicate playing cards, output `GRESKA`. Otherwise, in the order `P`, `K`, `H`, `T`, output how many cards are missing in that suit.

Explanation/Hint

#### Sample Explanation #### Sample 1 Explanation There is one card of suit `P`, one card of suit `K`, and two cards of suit `H`. #### Sample 2 Explanation There are two `H02`, so output `GRESKA`. #### Constraints For $100\%$ of the testdata, it is guaranteed that $1 \le \lvert s \rvert \le 10^3$, and $s$ contains only digits and `P`, `K`, `H`, `T`. The rank of each card satisfies $\in [1,13]$. #### Notes **This problem is worth $50$ points in total.** This problem is translated from [Croatian Open Competition in Informatics 2015/2016](https://hsin.hr/coci/archive/2015_2016) [Contest #1](https://hsin.hr/coci/archive/2015_2016/contest1_tasks.pdf) T1 KARTE。 Translated by ChatGPT 5