SHARE
TWEET

Untitled

a guest Oct 16th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2. s = input()
  3. flag = 0
  4. string = s[::-1]
  5. #print(set(s))
  6. while s != string and flag != n:
  7.     flag += 1
  8.     s = s[1:-1] + s[0]
  9. if flag == n:
  10.     print(-1)
  11. else:
  12.     print(flag)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top