from collections import defaultdict

S = eval(input())

alphabet = "abcdefghijklmnopqrstuvxyz"



if S == "zyxwvutsrqponmlkjihgfedcba":

    print((-1))

    exit()



dict = defaultdict(int)

for s in S:

    dict[s] += 1



if len(S) < len(alphabet):

    for a in alphabet:

        if dict[a] == 0:

            print((S + a))

            exit()

else:

    for i in range(24, -1, -1):

        for j in range(25, i, -1):

            if S[i] < S[j]:

                print((S[:i] + S[j]))

                exit()

print((-1))

s=eval(input())

alp="".join([chr(i) for i in range(97,97+26)])

if len(s)<26:

    for i in alp:

        if i not in s:

            print((s+i))

            exit()

else:

    if s=="".join([chr(i) for i in range(97,97+26)][::-1]):

        print((-1))

        exit()

    else:

        for i in range(24,-1,-1):

            for j in range(25,i,-1):

                if s[i]<s[j]:

                    print((s[:i]+s[j]))

                    exit()
from collections import defaultdict

S = eval(input())
alphabet = "abcdefghijklmnopqrstuvxyz"
if S == "zyxwvutsrqponmlkjihgfedcba":
    print((-1))
    exit()
dict = defaultdict(int)
for s in S:
    dict[s] += 1
if len(S) < len(alphabet):
    for a in alphabet:
        if dict[a] == 0:
            print((S + a))
            exit()
else:
    for i in range(24, -1, -1):
        for j in range(25, i, -1):
            if S[i] < S[j]:
                print((S[:i] + S[j]))
                exit()
print((-1))

s = eval(input())
alp = "".join([chr(i) for i in range(97, 97 + 26)])
if len(s) < 26:
    for i in alp:
        if i not in s:
            print((s + i))
            exit()
else:
    if s == "".join([chr(i) for i in range(97, 97 + 26)][::-1]):
        print((-1))
        exit()
    else:
        for i in range(24, -1, -1):
            for j in range(25, i, -1):
                if s[i] < s[j]:
                    print((s[:i] + s[j]))
                    exit()

-from collections import defaultdict - -S = eval(input()) -alphabet = "abcdefghijklmnopqrstuvxyz" -if S == "zyxwvutsrqponmlkjihgfedcba": -    print((-1)) -    exit() -dict = defaultdict(int) -for s in S: -    dict[s] += 1 -if len(S) < len(alphabet): -    for a in alphabet: -        if dict[a] == 0: -            print((S + a)) +s = eval(input()) +alp = "".join([chr(i) for i in range(97, 97 + 26)]) +if len(s) < 26: +    for i in alp: +        if i not in s: +            print((s + i)) -    for i in range(24, -1, -1): -        for j in range(25, i, -1): -            if S[i] < S[j]: -                print((S[:i] + S[j])) -                exit() -print((-1)) +    if s == "".join([chr(i) for i in range(97, 97 + 26)][::-1]): +        print((-1)) +        exit() +    else: +        for i in range(24, -1, -1): +            for j in range(25, i, -1): +                if s[i] < s[j]: +                    print((s[:i] + s[j])) +                    exit()