Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. n=int(input())
  2. s=str(input())
  3. s=list(s)
  4. ans=[]
  5. for i in range(0,n):
  6.     ans.append(s[i])
  7. hel=[]
  8. for i in s:
  9.     hel.append(i)
  10. hel.reverse()
  11. print(ans)
  12. tries=1
  13. ans.append(ans[0])
  14. ans.pop(0)
  15.  
  16. #print(hel)
  17. while (tries<2*n):
  18.     print(ans)
  19.     if ans==hel:
  20.         print(tries)
  21.         break
  22.        
  23.     if ans==s:
  24.         print(-1)
  25.         break
  26.     tries+=1
  27.     ans.append(ans[0])
  28.     ans.pop(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement