DCEPC207 - Finally a Treat

no tags 

Anuja ma’am is getting more and more obsessed by her name (actually she loves it!!!). She has a strong belief that her name has something very special but she could not make it out what is it. As Vaibhav sir is very good in finding pattern he helped her with her problem, that she has a name in which only one character has maximum frequency i.e. ‘a’. She became very happy and decided to give a party to all of the members of DCE Coders who have special names. But wait, she finds out that the list is too big, so she decided to narrow it down. Heres how she narrows it: “Anuja ma’am will give a party to all those whose name is special and the character which makes their name special MUST be the character with maximum frequency in the entire list of names. There is only ONE special character in the string.”

As a student you are required to make a list of names ELLIGIBLE for party.

Remember, a name is special only if a SINGLE character has the maximum frequency in it. (See example #2 )


1st line contains T(1<=T<=100), number of test cases. Next T lines contain a string(1<=Length of
String<=10000) containing list of names separated by SPACES.


Output k+1 lines for each test case, where k is the number of students ELLIGIBLE. First line
contains “Case #x:” where x is the case number starting from 1. Then next k lines contain the names
of ELLIGIBLE students.


Note: Each input string will have at least 1 word (of at least 1 character). i.e. there is no input string with only spaces


abcdd abccd cccd
aabb aabcc aaa adaa Output: Case #1:
Case #2:

hide comments
nadstratosfer: 2019-12-04 07:24:04

Had to drop all the convenient Python idioms to pass the TL, but it's a good lesson as a primitive C-like solution gets AC easily.

vengatesh15: 2017-09-08 09:19:54

easy one silly mistake cost's me 2 WA

kshubham02: 2017-01-16 11:18:17

Some clarifications that should have been part of the problem statement-
1. Order of the names is to be preserved.
2. Only lower case characters are present.

akshayvenkat: 2016-05-18 08:56:41

Last edit: 2016-05-18 18:21:43
Vipul Srivastava: 2015-06-21 15:47:26

Last edit: 2015-06-21 15:47:34
Pratyush Raj: 2015-02-22 09:18:33

i think there is some problem with this question.same code is getting wa and got accepted idk why...

shiv prasad chabarval: 2013-06-22 10:20:15

WA again and again....please help id:9527295

BLANKRK: 2013-06-06 18:34:53

m gettin WA.... any tricky tst cases...

Vimal Raj Sharma: 2012-06-08 11:21:21

all names are made up of small letters ?

Added by:dce coders
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem