program name
    implicit none
    character(26):: s
    integer(4):: ls,i,mic
    integer(4),allocatable:: si(:)
    logical:: is_use(26), f

    read*, s
    ls = len_trim(s)
    allocate(si(ls))

    do i=1,ls
        si(i) = ichar(s(i:i)) - ichar('a') + 1
    end do

    is_use(:) = .false.

    do i=1,ls
        is_use(si(i)) = .true.
    end do

    mic=10001
    do i=1,26
        if (.not. is_use(i))  mic=min(mic,i)
    end do
    f=.false.

    if (mic==10001) then
        do i=ls,2,-1
            if (si(i) > si(i-1)) then
                s(i-1:i-1) = char(ichar(s(i-1:i-1))+1)
                ls=i-1
                f=.true.
                exit
            end if
        end do
        if(f) then
            print*, s(1:ls)
            stop
        else
            print*, -1
            stop
        end if
    end if



    s(ls+1:ls+1) = char(mic+ichar('a')-1)

    print*, trim(s)


end program name