Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- k = int(input())
- s = input()
- ex = ans = 0
- for i in range(len(s) - k - 1, -1, -1):
- if s[i] == s[i + k]:
- ex += 1
- else:
- ex = 0
- ans += ex
- print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement