Are they all palindromes? P21691


Statement
 

pdf   zip

thehtml

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

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

Input

Input consists of several cases, each with s and ℓ. Let n be the size of s. You can assume 1 ≤ ℓ ≤ n ≤ 105, and that s 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++