Under construction

Still being built. Things may change

Basketball Game

Interview

Time limit1sMemory limit128 MB

Summary
Given N surnames, count first letters and print all letters (in order) that start at least five surnames, or PREDAJA if none does.
Level

Easy2 of 10

Topics
Hash map, Implementation, String
Solved
No attempts yet

Problem

A national basketball coach must choose a starting lineup for the next match. To make the lineup easy to remember, the coach wants to choose five players whose surnames start with the same lowercase English letter.

For every first letter that appears in at least five players' surnames, that letter can be used to form such a lineup. Find all possible first letters.

Input

The first line contains the number of players N (1 <= N <= 150).

Each of the next N lines contains one player's surname. Each surname consists only of lowercase English letters and has length at most 30.

Output

If no first letter appears in at least five surnames, print PREDAJA.

Otherwise, print all qualifying first letters in lexicographic order with no spaces between them.

Examples2

  1. Example 1

    Input
    18
    babic
    keksic
    boric
    bukic
    sarmic
    balic
    kruzic
    hrenovkic
    beslic
    boksic
    krafnic
    pecivic
    klavirkovic
    kukumaric
    sunkic
    kolacic
    kovacic
    prijestolonasljednikovi
    
    Expected output
    bk
    
  2. Example 2

    Input
    6
    michael
    jordan
    lebron
    james
    kobe
    bryant
    
    Expected output
    PREDAJA