import Data.List

alpha = ['a'..'z']

next' :: String -> String -> String
next' _ [] = "-1"
next' [] xs = next' [head xs] $ tail xs
next' c [x] =
  if x /= 'z' then [min x $ minimum c]
  else "-1"
next' c (x:xx:xs)
  | x<xx = next' (x:c) (xx:xs)
  | x>xx = reverse xs ++ [minimum c]

next :: String -> String -> String -> String
next str [] [] = next' [] $ reverse str 
next str [] alpha = str ++ [head alpha]
next str cs alpha = next str (tail cs) $ delete (head cs) alpha

main = do
  str <- getLine
  putStrLn $ next str str alpha
    
