fun nextPermutation(a: CharArray, b: Int, e: Int): Boolean {
  fun swap(a: CharArray, i: Int, j: Int) {
    val tmp = a[i]
    a[i] = a[j]
    a[j] = tmp
  }

  fun reverse(a: CharArray, b: Int, e: Int) {
    var b = b
    var e = e
    while (b < e) {
      e--
      swap(a, b, e)
      b++
    }
  }

  var e = e
  if (e - b < 2) return false
  val p = e
  e--
  while (b != e) {
    val q = e
    e--
    if (a[e] < a[q]) {
      var r = p
      while (a[e] >= a[--r]);
      swap(a, e, r)
      reverse(a, q, p)
      return true
    }
  }
  reverse(a, b, p)
  return false
}



fun main(args: Array<String>) {
  val s = readLine()!!
  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    println(-1)
    return
  }
  // println("zyxwvutsrqponmlkjihgfedcba".reversed())
  if (s.length < 26) {
    val alphabet = "abcdefghijklmnopqrstuvwxyz"
    val c = alphabet.first { !s.contains(it) }
    println(s + c)
    return
  }

  val cs = s.toCharArray()
  nextPermutation(cs, 0, cs.size)
  val t = String(cs)
  for (i in 0 until t.length) {
    if (!s.startsWith(t.substring(0, i))) {
      println(t.substring(0, i))
      return
    }
  }
  // println(String(cs))
  throw RuntimeException()
}
