Python-Indexing- I do not understand how this bit of code is working
<p>What I do not understand is how indexing a string s = "azcbobobegghakl" would correctly give me the answer 'beggh' if I was looking for the longest substring in alphabetical order. How does this code tell the computer that 'beggh' is in alphabetical order? I thought indexing just gave each letter in the string a number that increased by one until the string ended? I tweaked the code a bit and it worked, but I do not actually understand how the code works in the first place.   </p>

<pre><code>s = "azcbobobegghakl"
longest = s[0]
current = s[0]
for c in s[1:]:
    if c &gt;= current[-1]:
        current += c
    else:
        if len(current) &gt; len(longest):
            longest = current
        current = c
print "Longest substring in alphabetical order is:", longest
</code></pre>