import Data.List

main :: IO ()
main  = do
    str <- getLine
    putStrLn $ succStr str

succStr :: String -> String
succStr "zyxwvutsrqponmlkjihgfedcba" = "-1"
succStr s
    | length s < 26 = s ++ minimumNotIncluded s
    | otherwise     = (init dropped) ++ [succ (last dropped)]
        where dropped = reverse $ drop (reverseMax (init s) (last s) 1) (reverse s)

minimumNotIncluded :: String -> String
minimumNotIncluded s = included ['a' .. 'z']
    where included (a:as) = if elem a s then included as else (a : [])

reverseMax :: String -> Char -> Int -> Int
reverseMax s c i
    | last s == succ c = reverseMax (init s) (succ c) (i + 1)
    | otherwise        = i

