import java.util.*

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

  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    println(-1)
    return
  }


  val letters = Array(26) { 0 }
  for ((i, c) in s.withIndex()) {
    val a = c - 'a'
    letters[a] = i + 1
  }

  // println(letters.joinToString(" "))

  if (letters.contains(0)) {
    var tmp = 0
    for ((i, li) in letters.withIndex()) {
      if (li == 0) {
        tmp = i
        break
      }
    }
    val c = 'a' + tmp
    println(s + c.toString())
  } else {
    var pre = s.last()
    var index = 0
    val list = mutableListOf<Char>()
    list.add(pre)
    for (i in 24 downTo 0) {
      val now = s[i]
      if (now.toInt() < pre.toInt()) {
        index = i
        break
      }
      list.add(now)
      pre = now
    }
    val sub = s.substring(0, index)
    // println(list.joinToString(""))
    val last = list.filter { it.toInt() > s[index].toInt() }.sorted().first()
    println(sub + last)
  }



}
