title: Finding the longest substring in alphabetical order from a given string
body: <p>Ive been working on a question to find the longest substring in alphabetical order from a given string. I have a lot of experience in C++ but am absolutely new to python. Ive written this code</p>
  
  <pre><code>s = raw_input("Enter a sentence:")
  
  a=0   #start int
  b=0   #end integer
  l=0   #length
  i=0
  
  for i in range(len(s)-1):
      j=i
      if j!=len(s)-1:
      while s[j]&lt;=s[j+1]:
          j+=1
      if j-i&gt;l:  #length of current longest substring is greater than stored substring
          l=j-i
          a=i
          b=j
  
  print 'Longest alphabetical string is ',s[i:j]
  </code></pre>
  
  <p>But I keep on getting this error</p>
  
  <pre><code>Traceback (most recent call last):
    File "E:/python/alphabetical.py", line 13, in &lt;module&gt;
      while s[j]&lt;=s[j+1]:
  IndexError: string index out of range
  </code></pre>
  
  <p>What am I doing wrong here? Again, I am very new to python!</p>