Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t = int(input())
- s = input()
- r = s[::-1]
- s *= 2
- i = 0
- while i < len(s):
- t = 0
- while i < len(s) and s[i] == r[t]:
- t += 1
- i += 1
- if t == len(r):
- print(i - len(r))
- exit()
- i += 1
- print(-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement