title: Finding consecutive last letters: list index out of range when trying to loop through consecutive letters
body: <p>I am trying to find the words with the most consecutive last letters. For example in this string:</p>
  <pre><code>asd atsd ard afs agrs args ats
  </code></pre>
  <p>Here the output should be: <code>&quot;afs agrs args ats&quot;</code>.</p>
  <p>I am trying to do this with the following loop:</p>
  <pre><code>for i in range(0,len(wordlist)):
      current_letter = wordlist[i][-1]
      next_letter == wordlist[i+1][-1]
      if current_letter = next_letter:
          longest_sequence.append(current_letter)
  </code></pre>
  <p>Here after, I will compare length of the longest sequence to length of the <code>current_sequence</code>, and update it if <code>current_sequence</code> is longer.</p>
  <p>However, I am getting a <code>list index out of range error</code>. I do understand why this is, but I do not understand how I can solve this error without loosing the last letter of my list (through: <code>range(0,len(wordlist) - 1</code>).</p>
  <p>I have now changed the code to:</p>
  <pre><code>for i in range(0,len(wordlist) - 2):
      if wordlist[i][-1] == wordlist[i+1][-1]:
          print(wordlist[i], wordlist[i+1])
  </code></pre>
  <p>However, when inputting <code>&quot;tts attgs ghf ghhf loll lpl lpl wow&quot;</code> I only get the following: <code>&quot;tts attgs ghf ghhf loll lpl lpl lpl&quot;</code>. So when adding the second word in the consecutive pair, I seem to create a double when there are 3 consecutive endings. However I do not understand why this happens.</p>