let rec f c s =
  try let _ = String.index s (char_of_int c) in f (c+1) s
  with _ -> char_of_int c
let _ = Scanf.scanf "%s" @@ fun s ->
  let l = String.length s in
  let rec g i = if s.[i-1] < s.[i] then i-1 else g (i-1) in
  let rec h t c i = if i >= l then c else
    if t >= s.[i] then h t c (i+1) else h t (min c s.[i]) (i+1) in
  if s = "zyxwvutsrqponmlkjihgfedcba" then print_endline "-1"
  else if l < 26 then
    Printf.printf "%s%c\n" s (f 97 s)
  else
    let j = g (l-1) in
    Printf.printf "%s%c\n" (String.sub s 0 j) (h s.[j] 'z' (j+1))
