#K82482. K-Skip Palindrome Transformation

    ID: 35985 Type: Default 1000ms 256MiB

K-Skip Palindrome Transformation

K-Skip Palindrome Transformation

Given an integer \( k \) and a string \( s \), a k-skip palindrome is defined as follows: for some starting index \( 0 \leq start < k \), consider the subsequence
\[ s_{start}, s_{start+k+1}, s_{start+2(k+1)}, \dots \]
and check if this subsequence forms a palindrome.

Your task is to determine if the string \( s \) can be transformed into a k-skip palindrome by selecting a valid starting index. Formally, for a given \( k \) and \( s \), if there exists an integer \( start \) with \( 0 \leq start < k \) such that

\[ s_{start} s_{start+k+1} s_{start+2(k+1)} \cdots \text{ is a palindrome,} \]

then output YES; otherwise, output NO.

Note: A string is a palindrome if it reads the same forwards and backwards.

inputFormat

The input is given via standard input and consists of two lines:

  1. The first line contains a single integer \( k \).
  2. The second line contains the string \( s \) consisting of lowercase letters.

outputFormat

Output a single line containing either YES if the string can be transformed into a k-skip palindrome; otherwise, output NO.

## sample
1
abac
YES

</p>