let () =
  let a = Scanf.scanf "%s\n" (fun a -> a) in
  let input_char_list = BatString.to_list a in
  let all_chars = ['a';'b';'c';'d';'e';'f';'g';'h';'i';'j';'k';'l';'m';'n';'o';'p';'q';'r';'s';'t';'u';'v';'w';'x';'y';'z';] in

  let next_char c =
    let code = BatChar.code c in
    BatChar.chr (code + 1)
  in


  let hoge input_chars all_chars =
    let rec aux l = match l with
      | [] -> []
      | hd :: tl ->
        (
          match (BatList.find_opt (fun x -> x = hd) input_chars) with
            Some x -> aux tl
          | None -> [hd]
        )
    in
    aux all_chars
  in

  let test =
    match (hoge input_char_list all_chars) with
    | [] ->
      (
      if a = "zyxwvutsrqponmlkjihgfedcba"
      then "-1"
      else
        let rec fuga l top = match l with
          | [] -> []
          | aa :: bb :: cc ->
            if ((BatChar.code bb) - (BatChar.code aa) = 1)
            then
              fuga (bb :: cc) (BatList.append top [aa])
            else
              BatList.append top [(next_char aa)]
        in
        fuga input_char_list [] |> BatString.of_list
    )



    | [hd] -> BatList.append input_char_list [hd] |> BatString.of_list
  in

  print_endline test
