Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- n = int(input())
- s = input()
- s = list(s)
- s_copy = s
- s_inverse = s[::-1]
- k = 0
- for i in range(n):
- s_copy = s_copy[1:] + s_copy[:1]
- k += 1
- if s_copy == s_inverse:
- break
- if k == n:
- print(-1)
- else:
- print(k)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement