Missing String

3.3

3 votes
Algorithms, Medium, String Manipulation
Problem

Given a string consisting of lowercase letters only, find the typographically smallest string not present as a substring in it.

Given two string S1 and S2. S1 is considered typographically smaller than S2 if either:

|S1|<|S2||S1|=|S2| and S1is lexicographically smaller than S2

Input:

The first line of input contains the string S.

Output:

Answer as stated above.

Constraints:

1|S|105

Sample Input
saurabh
Sample Output
c
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The given string saurabh , does not contain c hence answer is c.

Editor Image

?