def get_all_substrings(string):
for index in range(len(string)):
yield string[index:]
def get_bigest_substring(string):
for index, characters in enumerate(zip(string, string[1:])):
a, b = characters
if b < a:
return string[:index+1]
return string
substrings = (get_bigest_substring(string)
for string in get_all_substrings('azcbobobegghakl'))
bigest_substring = max(substrings, key=len)
print(bigest_substring)
ZGVmIGdldF9hbGxfc3Vic3RyaW5ncyhzdHJpbmcpOgogICAgZm9yIGluZGV4IGluIHJhbmdlKGxlbihzdHJpbmcpKToKICAgICAgICB5aWVsZCBzdHJpbmdbaW5kZXg6XQogICAgICAgIApkZWYgZ2V0X2JpZ2VzdF9zdWJzdHJpbmcoc3RyaW5nKToKICAgIGZvciBpbmRleCwgY2hhcmFjdGVycyBpbiBlbnVtZXJhdGUoemlwKHN0cmluZywgc3RyaW5nWzE6XSkpOgogICAgICAgIGEsIGIgPSBjaGFyYWN0ZXJzCiAgICAgICAgaWYgYiA8IGE6CiAgICAgICAgICAgIHJldHVybiBzdHJpbmdbOmluZGV4KzFdCiAgICByZXR1cm4gc3RyaW5nCiAgICAKc3Vic3RyaW5ncyA9IChnZXRfYmlnZXN0X3N1YnN0cmluZyhzdHJpbmcpIAogICAgZm9yIHN0cmluZyBpbiBnZXRfYWxsX3N1YnN0cmluZ3MoJ2F6Y2JvYm9iZWdnaGFrbCcpKQogICAgCmJpZ2VzdF9zdWJzdHJpbmcgPSBtYXgoc3Vic3RyaW5ncywga2V5PWxlbikKICAgIApwcmludChiaWdlc3Rfc3Vic3RyaW5nKQoK