let s, f = read_line (), Printf.printf "%s%c\n"
let n = String.length s
let _ = String.(if n < 26 then Char.(for i = code 'a' to code 'z' do try index s (chr i) |> ignore with _ -> f s (chr i); exit 0 done) else let j = ref ~-1 in iteri (fun i c -> if i > 0 && s.[i - 1] < c then j := i - 1) s; if !j < 0 then print_endline "-1" else let m = ref 'z' in for i = !j + 1 to n - 1 do if s.[i] > s.[!j] then m := min !m s.[i] done; f (sub s 0 !j) !m)