Under construction

Still being built. Things may change

Card Set

Interview

Time limit1sMemory limit32 MB

Summary
Split S into 3-character card names, print GRESKA if any card repeats, otherwise print the missing count out of 13 for suits P, K, H and T.
Level

Easy3 of 10

Topics
Hash map, String
Solved
No attempts yet

Problem

Jinsol took up robotics and decided to build a robot that checks whether a set of poker cards is complete. The robot's job is to recognize the suit and the number of a card. To keep the task simple, assume that every card has exactly one suit and one number.

Each suit is written as a letter instead of the actual symbol. A spade is P, a heart is K, a diamond is H, and a club is T. The number is an integer from 1 to 13.

The robot writes a card as a three-character card name TXY. T is the suit letter and XY is the number written with two digits. If the number has one digit, a leading zero is added, so X is 0. For example, the card with suit P and number 9 is named P09.

A complete set has 52 cards, one for each of the 4 suits combined with each of the 13 numbers.

The robot reads the names of all the cards it currently holds and joins them into one string SS. Write a program that reads SS and counts how many cards of each suit are missing. If the same card appears twice, print GRESKA instead of the counts.

Input

The first line contains the string SS (1≤∣S∣≤10001 \le |S| \le 1000). SS is the concatenation of the names of the cards currently held, and its length is always a multiple of 3.

Output

If the same card appears twice, print GRESKA.

Otherwise print four integers, the number of missing cards for P, K, H, and T in that order. Separate the integers with a single space.

Examples3

  1. Example 1

    Input
    P01K02H03H04
    
    Expected output
    12 12 11 13
    
  2. Example 2

    Input
    H02H10P11H02
    
    Expected output
    GRESKA
    
  3. Example 3

    Input
    P10K10H10T01
    
    Expected output
    12 12 12 12