title: Booth Algorithm in string
body: <p>I tried solving this <a href="http://www.spoj.pl/problems/BEADS/" rel="nofollow">problem</a> in SPOJ using <a href="http://en.wikipedia.org/wiki/Lexicographically_minimal_string_rotation" rel="nofollow">Booth Algorithm</a> in O(n) time, but it failed though it worked for all test cases I tried.<br />
  Then I did in Brute force way in O(n^2) time, it worked. I have attached the code for both the cases, tell me where I went wrong or is Booth algo a correct approach for this problem?</p>
  
  <p>Isnt the problem, finding the minimum rotation for Lexicographically smallest string</p>
  
  <p>For first approach, Booth Algorithm : <a href="http://ideone.com/J5gl5" rel="nofollow">http://ideone.com/J5gl5</a><br />
  For second approach, Brute Force : <a href="http://ideone.com/ofTeA" rel="nofollow">http://ideone.com/ofTeA</a></p>