the only catch is that is has to be in alphabetical order: Where the unicode value is bigger than the previous character. If i have a string with the letters "owdnloquxat" then it would only print "loqux" since this is the longest substring in alphabetical order.
I've tried this code. However, in this instance it only prints "az", but it should print "beggh"
s = 'azcbobobegghakl'
sList = list(s)
sub = s[0]
long, lenght = sub, 1
for i in s[1:]:
if ord(sub[-1]) <= ord(i):
sub += i
print(sub)
I am quite new to python, but need to complete this for a course. If you want to give answers, that's fine. Hints would be fine as well since i want to learn.