A k-double string is a non-empty string consisting of two equal length halves, where the first half differs from the second half at no more than k positions. For example, "contestcontest", "oopoop" and "aa" are 0-double strings. "contestkontest" is a 1-double string, and "poorpork", "artbat", and "yesyep" are 2-double strings. Obviously, all 0-double strings are also 1-double strings, all 1-double strings are also 2-double strings, etc.
You will be given a String str and an int k. Concatenate the elements of str to form one long string, and return the number of k-double substrings contained in that string.
If the same string exists in several different positions, count it as many times as it exists. Also, k-double substrings can overlap. See the examples for more details.