fun main(args : Array<String>) {
    val s = readLine()!!

    if (s.length < 26) {
        for (c in 'a'..'z') {
            if (!s.contains(c)) {
                println("$s$c")
                return
            }
        }
    }

    val stocks = mutableListOf<Char>()
    for (i in 25 downTo 0) {
        val c = stocks.filter { it > s[i] }.min()
        if (c != null) {
            println("${s.take(i)}$c")
            return
        } else {
            stocks.add(s[i])
        }
    }

    println(-1)
}