import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val t = s.map { it }.toTypedArray()

    for (v in 'a'..'z') {
        if (v !in s) {
            println(s + v)
            return
        }
    }
    if (!nextPermutation(t)) {
        println(-1)
    } else {
        var i = 0
        while (s[i] == t[i]) {
            print(s[i])
            i++
        }
        println(t[i])
    }
}

fun nextPermutation(t: Array<Char>): Boolean {
    val n = t.size
    var i = n - 2

    while (i >= 0 && t[i] >= t[i + 1]) {
        i--
    }
    if (i == -1) {
        return false
    }

    var j = i + 1
    while (j < n && t[j] > t[i]) {
        j++
    }
    j -= 1
    var tmp = t[i]
    t[i] = t[j]
    t[j] = tmp

    var left = i + 1
    var right = n - 1

    while (left < right) {
        tmp = t[left]
        t[left] = t[right]
        t[right] = tmp
        left++
        right--
    }
    return true
}
