Question
Word Quest
Unique runes are words formed by distinct lowercase letters, such as "comet" or "glyph", but not "brook" or "scanner". Given a unique rune, identify the smallest unique rune that is lexicographically greater than it.
Input
The first and only line of input consists of a single string S.
Output
Print the smallest unique rune which is lexicographically larger than the given unique rune. Print -1 if it doesn't exist.
Example
Sample Input
abc
Sample Output
abcd
Explanation
The smallest unique rune which is lexicographically larger than given one is abcd, given no other result is possible.

Online