Buggy python submission (verdict: Runtime Error):
import string
def main():
    s = input()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        return
    for i in "abcdefghijklmnopqrstuvwxyz@":
        if i == "@":
            t = 0
            for x in range(len(s)-1, 0, -1):
                for y in range(x-1, -1, -1):
                    if x == y:
                        continue
                    if s[x] > s[y]:
                        print(s.translate(string.maketrans(s[x],x[y])))
                        return 
        if s.count(i) == 0:
            print (s + i)
            break

main()



Fixed submission:
import string

alp = string.ascii_lowercase

def main():
    s = input()
    if len(s) < 26:
        for i in alp:
            if i not in s:
                print (s + i)
                return
    if s == alp[::-1]:
        print(-1)
        return
    L = len(s)
    tmp = []
    tt = ''
    for i, ss in enumerate( s ):
        tmp += [ s[L-i-1] ]
        if s[L-i-1] > s[L-i-2]:
            ans = s[:L-i-2]
            tt = s[L-i-2] 
            break
    tmp.sort()
    for i in tmp:
        if i > tt:
            print (ans + i)
            break
main()

Buggy python submission (verdict: Runtime Error):
import string
def main():
    s = input()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        return
    for i in "abcdefghijklmnopqrstuvwxyz@":
        if i == "@":
            t = 0
            for x in range(len(s), 0, -1):
                for y in range(x-1, -1, -1):
                    if x == y:
                        continue
                    if s[x] > s[y]:
                        print(s.translate(string.maketrans(s[x],x[y])))
                        return 
        if s.count(i) == 0:
            print (s + i)
            break

main()



Fixed submission:
import string

alp = string.ascii_lowercase

def main():
    s = input()
    if len(s) < 26:
        for i in alp:
            if i not in s:
                print (s + i)
                return
    if s == alp[::-1]:
        print(-1)
        return
    L = len(s)
    tmp = []
    tt = ''
    for i, ss in enumerate( s ):
        tmp += [ s[L-i-1] ]
        if s[L-i-1] > s[L-i-2]:
            ans = s[:L-i-2]
            tt = s[L-i-2] 
            break
    tmp.sort()
    for i in tmp:
        if i > tt:
            print (ans + i)
            break
main()

Buggy python submission (verdict: Runtime Error):
import string
def main():
    s = input()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        return
    for i in "abcdefghijklmnopqrstuvwxyz@":
        if i == "@":
            t = 0
            for x in range(len(s), -1, 0):
                for y in range(x-1, -1, -1):
                    if x == y:
                        continue
                    if s[x] > s[y]:
                        print(s.translate(string.maketrans(s[x],x[y])))
                        return 
        if s.count(i) == 0:
            print (s + i)
            break

main()



Fixed submission:
import string

alp = string.ascii_lowercase

def main():
    s = input()
    if len(s) < 26:
        for i in alp:
            if i not in s:
                print (s + i)
                return
    if s == alp[::-1]:
        print(-1)
        return
    L = len(s)
    tmp = []
    tt = ''
    for i, ss in enumerate( s ):
        tmp += [ s[L-i-1] ]
        if s[L-i-1] > s[L-i-2]:
            ans = s[:L-i-2]
            tt = s[L-i-2] 
            break
    tmp.sort()
    for i in tmp:
        if i > tt:
            print (ans + i)
            break
main()

Buggy python submission (verdict: Runtime Error):
import string
def main():
    s = input()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        return
    for i in "abcdefghijklmnopqrstuvwxyz@":
        if i == "@":
            t = 0
            for x in range(len(s), -1, 0):
                for y in rnage(x-1, -1, -1):
                    if x == y:
                        continue
                    if s[x] > s[y]:
                        print(s.translate(string.maketrans(s[x],x[y])))
                        return 
        if s.count(i) == 0:
            print (s + i)
            break

main()



Fixed submission:
import string

alp = string.ascii_lowercase

def main():
    s = input()
    if len(s) < 26:
        for i in alp:
            if i not in s:
                print (s + i)
                return
    if s == alp[::-1]:
        print(-1)
        return
    L = len(s)
    tmp = []
    tt = ''
    for i, ss in enumerate( s ):
        tmp += [ s[L-i-1] ]
        if s[L-i-1] > s[L-i-2]:
            ans = s[:L-i-2]
            tt = s[L-i-2] 
            break
    tmp.sort()
    for i in tmp:
        if i > tt:
            print (ans + i)
            break
main()