let rec solve s i =
  if s.[i - 1] < s.[i] then i
  else solve s (i - 1)

let () =
  let s = read_line () in
  print_endline @@
  if s = "zyxwvutsrqponmlkjihgfedcba" then "-1"
  else if String.length s = 26 then
    solve s 25
    |> (fun n ->
        String.sub s 0 (n - 1) ^
        String.make 1 (
        Array.init (26 - n) (fun i ->
          if s.[n + i] < s.[n - 1] then '\255'
          else s.[n + i])
        |> Array.fold_left min '\255'))
  else
    Array.init 26 (fun i -> Char.chr (Char.code 'a' + i))
    |> Array.to_list
    |> List.find (fun c ->
        Array.init (String.length s) (fun i -> s.[i])
        |> Array.to_list
        |> List.for_all (( <> ) c))
    |> String.make 1
    |> ( ^ ) s