Searching for Palindromes
Very easy
Execution time limit is 2 seconds
Runtime memory usage limit is 64 megabytes
A string is referred to as a palindrome if it reads the same forwards and backwards, such as "madam" or "bob".
Your task is to determine how many palindromes of a specified length K exist within the given string S.
Input
The first line contains an integer K (2 ≤ K ≤ 200). The second line contains the string S, which is composed solely of Latin letters. Note that uppercase and lowercase letters are distinct (for example, "Bob" is not considered a palindrome). The length of S ranges from 1 to 30000 characters.
Output
Output a single line with the number of distinct palindromes of length K found in S. These palindromes are sequences of consecutive characters in S, with distinct palindromes being those that start at different positions within S.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 34%