class Word(str:String){
    val nextDiverseWord:String?
    init{
        var next:String? = null
        when(str.length){
            26 -> when(str == str.toCharArray().sortedDescending().joinToString()){
                true -> next = null
                false -> {
                        loop@for (idx in 24 downTo 0) {
                            if (str[idx + 1] > str[idx]) {
                                val target = str.substring(idx + 1).toCharArray().filter { it > str[idx] }.min() ?: str[25]
                                next = str.substring(0 until idx) + target
                                break@loop
                            }
                        }
                }
            }
            else -> Array(26){0}.apply {
                for (c in str){
                    ++this[c - 'a']
                }
                next = str + ('a' + this.indexOfFirst { it == 0 })
            }
        }
        nextDiverseWord = next
    }
}

fun main(args:Array<String>):Unit{
    println(Word(readLine()!!).nextDiverseWord ?: -1)
}