title: Find all repeating non-overlapping substrings and cycles
body: <p>I have a complex problem of string manipulation at hand.
  I have a string in which I will have cycles, as well as recurrences which I need to identify and list down.</p>
  
  <pre><code>'abcabcabcabcabcdkkabclilabcoabcdieabcdowabcdppabzabx'
  </code></pre>
  
  <p>Following are the possible patterns -></p>
  
  <blockquote>
    <p>Actual indexes not used</p>
    
    <p>abc -> 0,3,6,9,12,15,17, ..... (occurence index for recurring string),
    0,3,6,9 (unique_occurence index  for recurring string, 12, 15, 17
    disqualified as there <code>abc</code> was a part of longer repeating substring) </p>
    
    <p>abcd -> 12, 15, 17 (occurence index  for recurring string), 12, 15, 17
    (unique occurence index for recurring string)</p>
    
    <p><em>bcda -> 13, 16, 18.. (occurence index for recurring string),  (unique occurence index for recurring string) as it is an overlap for
    the string abcd</em> Hence it is something not required ab ->
    0,3,6,9,12,15,17, 25, 27 ...(occurence index for recurring string),
    25, 27(unique occurence index for recurring string). .....</p>
  </blockquote>
  
  <p>I want to find all <code>unique recurring occurences/recurrences</code>, i.e. All Unique, Non-Overlapping values of recurring string. As mentioned above. And the input string may contain, </p>
  
  <p>ALL cyclic patterns(<code>abcabcabcdefdefdeflkjlkjlkj</code> => <code>abc</code>, <code>def</code>, <code>lkj</code> are recurrences in cycle, but <code>bc</code>, <code>ab</code>, <code>bcab</code> are not expected as they are outcomes of false positives)
  OR</p>
  
  <p>Separately recurring patterns(<code>abcxabcdabcm</code> => <code>abc</code> is recurrence but not cycle, i.e. they are not adjecent) 
  Or </p>
  
  <p>A mix of both(<code>abcabcabcabcabclkabcdokabcdhuabcd</code> => <code>abc</code> is a cyclic recurrence, and <code>abcd</code> is a non cyclic recurrence and we need to find both -> only <code>abcd</code>, <code>abc</code> are recurring, not <code>bc</code>, <code>ab</code>, <code>bcda</code>, etc)</p>
  
  <p>Can someone propose a solution algo for this problem statement. I am trying using suffix_arrays which is not finding overlapping results as well.</p>