Buggy python submission (verdict: Runtime Error):
s = list(input())
m = list('zyxwvutsrqponmlkjihgfedcba')
if len(s) < 26:
    for i in m[::-1]:
        if not j in s:
            s.append(j)
            break
    print(''.join(s))
else:
    if s == m:
        print(-1)
    else:
        x = s[-1]
        for i in range(25)[::-1]:
            if x > s[i]:
                s = s[:i]
                s.append(x)
                break
            if i == 0:
                z = m.index(s[0])
                s = m[z-1]
                break
        print(''.join(s))

Fixed submission:
s = list(input())
m = list('zyxwvutsrqponmlkjihgfedcba')
if len(s) < 26:
    for i in m[::-1]:
        if not i in s:
            s.append(i)
            break
    print(''.join(s))
else:
    x = s[-1]

    for i in range(25)[::-1]:
        if x > s[i]:
            y = m.index(s[i])
            s = s[:i]
            for j in range(y)[::-1]:
                if not m[j] in s:
                    s.append(m[j])
                    break
            break
        else:
            x = s[i]
        if i == 0:
            print(-1)
            exit(0)
    print(''.join(s))

Buggy python submission (verdict: Runtime Error):
s = list(input())
m = list('zyxwvutsrqponmlkjihgfedcba')
if len(s) < 26:
    for i in m:
        if not i in s:
            s.append(_)
            break
    print(''.join(s))
else:
    if s == m:
        print(-1)
    else:
        x = s[-1]
        for i in range(25)[::-1]:
            if x > s[i]:
                s = s[:i]
                s.append(i)
                break
            if i == 0:
                z = m.index(s[0])
                s = m[z-1]
        print(''.join(s))



Fixed submission:
s = list(input())
m = list('zyxwvutsrqponmlkjihgfedcba')
if len(s) < 26:
    for i in m[::-1]:
        if not i in s:
            s.append(i)
            break
    print(''.join(s))
else:
    x = s[-1]

    for i in range(25)[::-1]:
        if x > s[i]:
            y = m.index(s[i])
            s = s[:i]
            for j in range(y)[::-1]:
                if not m[j] in s:
                    s.append(m[j])
                    break
            break
        else:
            x = s[i]
        if i == 0:
            print(-1)
            exit(0)
    print(''.join(s))

Buggy python submission (verdict: Runtime Error):
s = list(input())
n = list('abcdefghijklmnopqrstuvwxyz')
if len(s) < 26:
    for _ in m:
        if not _ in s:
            s.append(_)
            break
    print(''.join(s))
else:
    if s == n[::-1]:
        print(-1)
    else:
        x = s[-1]
        for _ in range(25)[::-1]:
            if x > s[_]:
                s = s[:_]
                s.append(x)
                break
        print(''.join(s))

Fixed submission:
s = list(input())
m = list('zyxwvutsrqponmlkjihgfedcba')
if len(s) < 26:
    for i in m[::-1]:
        if not i in s:
            s.append(i)
            break
    print(''.join(s))
else:
    x = s[-1]

    for i in range(25)[::-1]:
        if x > s[i]:
            y = m.index(s[i])
            s = s[:i]
            for j in range(y)[::-1]:
                if not m[j] in s:
                    s.append(m[j])
                    break
            break
        else:
            x = s[i]
        if i == 0:
            print(-1)
            exit(0)
    print(''.join(s))

Buggy python submission (verdict: Runtime Error):
s = input()
if s == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    exit(0)
l = list('abcdefghijklmnopqrstuvwxyz')
for i in range(26):
    if l[i] != s[i]:
        print(s[:i-1] + l[i])
        exit(0)

Fixed submission:
s = list(input())
m = list('zyxwvutsrqponmlkjihgfedcba')
if len(s) < 26:
    for i in m[::-1]:
        if not i in s:
            s.append(i)
            break
    print(''.join(s))
else:
    x = s[-1]

    for i in range(25)[::-1]:
        if x > s[i]:
            y = m.index(s[i])
            s = s[:i]
            for j in range(y)[::-1]:
                if not m[j] in s:
                    s.append(m[j])
                    break
            break
        else:
            x = s[i]
        if i == 0:
            print(-1)
            exit(0)
    print(''.join(s))