title: Longest repeating substring using for-loops and if-statements
body: <p>I'm in an introductory level programming class that teaches python.  I was introduced to a longest repeating substring problem for a project and I can't seem to crack it.  I've looked on here for a solution, but I haven't learned suffix trees yet so I wouldn't be able to use them.  So far, I've gotten here:</p>
  
  <pre><code>msg = "kalhfdlakdhfklajdf" (anything)
  
  for i in range(len(msg)):
      if msg[i] == msg[i + 1]:
          reps.append(msg[i])
  </code></pre>
  
  <p>What this does is scan my string, msg, and check to see if the counter matches the next character in sequence.  If the characters match, it appends msg[i] to the list "reps". My problem is that:
  a) The function I created always appends one less than repetition amount, and 
  b) my function program always crashes due to msg[i+1] going out of bounds once it reaches the last spot on the list.</p>
  
  <p>In essence, I want my program to find repeats, append them to a list where the highest repeating character is counted and returned to the user.</p>