Are they all palindromes? P21691


Statement
 

pdf   zip

You are given a string ss and a length ℓ\ell. Are all the substrings of length ℓ\ell of ss palindromes?

For instance, let s=s = “ababa” and ℓ=3\ell = 3. Here, we have s[0..2]=s[0..2] = “aba”, s[1..3]=s[1..3] = “bab” and s[2..4]=s[2..4] = “aba”. Since the three substrings of ss of length 3 are palindomes, in this case the answer is positive.

Input

Input consists of several cases, each with ss and ℓ\ell. Let nn be the size of ss. You can assume 1≤ℓ≤n≤1051 \le \ell \le n \le 10^5, and that ss is made up of only lowercase letters.

Output

For every case, print “yes” or “no”.

Public test cases
  • Input

    ababa 3
    abracadabra 5
    zz 2
    

    Output

    yes
    no
    yes
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++