title: How to find the number of the lexicographically minimal string rotation?
body: <p>How to find the number of <a href="http://en.wikipedia.org/wiki/Lexicographically_minimal_string_rotation">lexicographically minimal string rotation</a>?</p>
  
  <p>For example:</p>
  
  <pre>
  S = abab, N = 2
  S = abca, N = 1
  S = aaaa, N = 4
  </pre>
  
  <p>I tried Duval's algorithm, it works very long. The string length of 100000000 characters.</p>