let s = read_line ()
let n = String.length s
let fs, is, i = Array.(make 26 false, make 26 0, ref 0)
let _ = String.(Char.(iter (fun c -> let n = code c - 97 in fs.(n) <- true; is.(!i) <- n; incr i) s;
  if n < 26 then (i := 0; while fs.(!i) do incr i done; Printf.printf "%s%c\n" s (chr (!i + 97)))
  else (for j = n - 1 downto 0 do i := code s.[j] - 96; while !i < 26 && fs.(!i) do incr i done; if !i < 26 then (Printf.printf "%s%c\n" (sub s 0 j) (chr (!i + 97)); exit 0) else (fs.(is.(j)) <- false) done; print_endline "-1")))