TRENER - Trener

no tags 

 

Mirko has been moving up in the world of basketball, starting as a mere spectator, mastering snack 
salesmanship, finally reach the coveted position of the national team coach. He is now facing a difficult 
task: selecting the five primary players for the upcoming match against Tajikistan. 
Since Mirko is incredibly lazy, he doesn't bother remembering players' names, let alone their actual 
skills. That's why he has settled on selecting five players who share the same first letter of their 
surnames, so that he can remember them more easily. If there are no five players sharing the first letter 
of their surnames, Mirko will simply forfeit the game! 
In order to obtain insight into possibilities for his team, Mirko wants to know all the different letters 
that his primary team's surnames may begin with.

Mirko has been moving up in the world of basketball, starting as a mere spectator, mastering snack 

salesmanship, finally reach the coveted position of the national team coach. He is now facing a difficult 

task: selecting the five primary players for the upcoming match against Tajikistan. 

Since Mirko is incredibly lazy, he doesn't bother remembering players' names, let alone their actual 

skills. That's why he has settled on selecting five players who share the same first letter of their 

surnames, so that he can remember them more easily. If there are no five players sharing the first letter 

of their surnames, Mirko will simply forfeit the game! 

In order to obtain insight into possibilities for his team, Mirko wants to know all the different letters 

that his primary team's surnames may begin with.

 

Input

The first line of input contains the positive integer N (1 ≤ N ≤ 150), the number of players that Mirko 

has available. 

Each of the following N lines contains one word (at most 30 characters long, consisting only of 

lowercase English letters), a surname of one of the players

Output

If there are no five players that Mirko can select matching his criteria, output a single line containing 

the word “PREDAJA" (without quotes). Otherwise, output all possible first letters of representation 

player surnames, sorted lexicographically, in a single line with no spaces.

Example

Input:
18 
babic 
keksic 
boric 
bukic 
sarmic 
balic 
kruzic 
hrenovkic 
beslic 
boksic 
krafnic 
pecivic 
klavirkovic 
kukumaric 
sunkic 
kolacic 
kovacic 
prijestolonasljednikovic

Output:
bk

Input:
6 
michael 
jordan 
lebron 
james 
kobe 
bryant 

Output:
PREDAJA

hide comments
more_practice: 2016-06-27 22:16:34

2 line code

Francky: 2014-05-13 09:41:19

Moved.

The Exorcist: 2014-05-13 09:00:32

Tutorial stuff..

Rey: 2014-02-22 11:02:56

accepted.. simple one!!

Last edit: 2014-02-22 11:05:20
freaker: 2014-02-21 15:15:20

easy one , AC in first attempt !!!

Last edit: 2014-02-21 15:18:28
RIVU DAS: 2014-02-20 16:53:00

Tutorial stuff!!

Roman Hajduk: 2014-01-06 15:39:55

Can u check my submission please? my ID is 10812369.

Ankit Jain: 2013-12-16 20:19:23

simple problem....:)

dwi_suseno: 2013-12-09 11:29:44

why I got WA. what's wrong? any requirements else?

salvager: 2013-11-25 08:55:29

why is this showing WA


Added by:Tomislav Babic
Date:2013-10-05
Time limit:0.406s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:COCI 2013 1. round