title: How do I find the largest sequence in a string that is repeated at least once?
body: <p>Trying to solve the following problem:</p>
  
  <blockquote>
    <p>Given a string of arbitrary length, find the longest substring that occurs more than one time within the string, with no overlaps.</p>
  </blockquote>
  
  <p>For example, if the input string was <code>ABCABCAB</code>, the correct output would be <code>ABC</code>.  You couldn't say <code>ABCAB</code>, because that only occurs twice where the two substrings overlap, which is not allowed.</p>
  
  <p>Is there any way to solve this reasonably quickly for strings containing a few thousand characters?</p>
  
  <p>(And before anyone asks, this is not homework.  I'm looking at ways to optimize the rendering of Lindenmayer fractals, because they tend to take excessive amounts of time to draw at high iteration levels with a naive turtle graphics system.)</p>