YOYOCQM - Yo Yo Jagdish Singh

Like many teenagers of his age, Jagdish is into Honey Singh these days, and has decided to enter a rapping contest. A rap song can be represented as a single word of uppercase characters (A-Z). The contest assigns score based on the smallest length word which is not a substring of the song. The participant with the highest score gets a chance to meet with Honey Singh.
Jagdish is pumped up about this, and starts writing his song. He asks Anandi for help. Anandi being a Heavy Metal fan, dislikes the whole idea. However, she ends up helping Jagdish by evaluating his songs by finding a string (containing uppercase letters) with smallest length which is not a substring of the song. If multiple strings of same lengths are present, the lexicographically smallest one is considered as the result. Help Anandi find such string.

Input
Each line represents an input, consisting of a string (made up of uppercase characters A-Z). Read till EOF

Output
For each input, output the result string.

Constraints
There will be 100 test cases.
1<= Length of input string <= 10^4

Sample Input
ABCD
BBB

Sample Output
E
A


Added by:VV
Date:2015-01-28
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 JS-MONKEY
Resource:Own problem (CQM 8, BIT Mesra)

hide comments
2020-05-05 21:41:39
I wouldn't say my solution's AC was unexpected, but Vectar's comment did give me a hint.
2015-12-16 19:09:46 Piyush Kumar
An unexpected solution passed.
2015-06-09 13:17:20
Anandi being a heavy metal fan
LOL
2015-04-17 20:00:03 ashish jaiswal
Test cases=100 or EOF?? check my code plz..
plz check what wrong in my code..id= 14110879

Last edit: 2015-04-17 20:07:31
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.