Buggy python submission (verdict: Runtime Error):
from string import*
from itertools import*
b = ascii_lowercase
s = input()
if len(s) < 26:
    x = z = s;y = b;d = 0
else:
    d = -[p*len(list(k)) for p, k in groupby([i < j for i, j in zip(s[-1::-1], s[-2::-1])])][0] - 2
    x, y, z = s[:d], s[d+1:], b[:ord(s[d]) - 97]
print(-(d < -26) or x + sorted(set(y) - set(z))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*
from itertools import*
b = ascii_lowercase
s = input()
if len(s) < 26:
    x = z = s, y = b, d = 0
else:
    d = -[p*len(list(k)) for p, k in groupby([i < j for i, j in zip(s[-1::-1], s[-2::-1])])][0] - 2
    x, y, z = s[:d], s[d+1:], b[:ord(s[d]) - 97]
print(-(d < -26) or x + sorted(set(y) - set(z))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*
from itertools import*
b = ascii_lowercase
s = input()
if len(s) < 26:
    x = z = s, y = b, d = 0
else:
    d = [p*len(list(k)) for p, k in groupby([i < j for i, j in zip(s[-1::-1], s[-2::-1])])][0] - 2
    x, y, z = s[:d], s[d+1:], b[:ord(s[d]) - 97]
print(-(d < -26) or x + sorted(set(y) - set(z))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*
from itertools import*
b = ascii_lowercase
s = input()
if len(s) < 26:
    x = z = s, y = b, d = 0
else:
    d = [p*len(list(k)) for p, k in groupby([i < j for i, j in zip(s[-1::-1], t[-2::-1])])][0] - 2
    x, y, z = s[:d], s[d+1:], b[:ord(s[d]) - 97]
print(-(d < -26) or x + sorted(set(y) - set(z))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*
from itertools import*
b = ascii_lowercase
s = input()
if len(s) < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    d = [p,len(list(k)) for p, k in groupby([i < j for i, j in zip(s[-1::-1], t[-2::-1])])][0] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    d = [p,*len(list(k)) for p, k in groupby([i < j for i, j in zip(s[-1::-1], t[-2::-1])])][0] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*;from itertools import*;b=ascii_lowercase;r=s=input();d=l=len(s);t=s[::-1];o=1
if l>25:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(s[::-1],s[-2::-1])])][0]-2;s,b,o=s[:d],s[d+1:],0
print(-(d<-26)or s+sorted(set(b)-set(s*o or b[:ord(s[d])-97]))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*;from itertools import*
b=ascii_lowercase;r=s=input();d=l=len(s);t=s[::-1]
if l>25:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(s[::-1],s[-2::-1])])][0]-2;s,b,o=s[:d],s[d+1:],1
print(-(d<-26)or s+sorted(set(b)-set([s,b[:ord(s[d])-97]][o]))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

Buggy python submission (verdict: Runtime Error):
from string import*;from itertools import*;b=ascii_lowercase;r=s=input();d=l=len(s);t=s[::-1]
if l>25:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(s[::-1],s[-2::-1])])][0]-2;s,b,o=s[:d],s[d+1:],1
print(-(d<-26)or s+sorted(set(b)-set([s,b[:ord(s[d])-97]][o]))[0])

Fixed submission:
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])