fun main(args: Array<String>) {
    agc022a()
}

fun agc022a() {
    val s = readLine()!!.toCharArray()

    if (s.size < 26) {
        val find = ('a'..'z').find { !s.contains(it) }!!
        return println(s + find)
    }


    val indexOfFirst =
        (s.lastIndex downTo 1).firstOrNull { s[it] > s[it - 1] }
    val replaceIndex = when (indexOfFirst) {
        -1, null -> return println(-1)
        else -> indexOfFirst - 1
    }

    val replaceChar = s[replaceIndex]
    val answer = s.slice(0 until replaceIndex) +
            s.slice(replaceIndex..s.lastIndex).findLast { it > replaceChar }

    println(answer.joinToString(""))
}
