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
hide comments
nadstratosfer:
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. |
|
Piyush Kumar:
2015-12-16 19:09:46
An unexpected solution passed. |
|
maverick_10:
2015-06-09 13:17:20
Anandi being a heavy metal fan
|
|
ashish jaiswal:
2015-04-17 20:00:03
Test cases=100 or EOF?? check my code plz..
|
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) |