import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param s string字符串 
     * @param k int整型 
     * @return int整型
     */
    public int numKLenSubstrRepeats (String s, int k) {
        // write code here
        char[] str = s.toCharArray();
        int i = 0;
        
        int count = 0;
        for (; i <= str.length - k; i++){
            if (isEquality(str, i, k)){
                count++;
            }
        }

        return count;
    }
    public boolean isEquality(char[] str, int i, int k){
        int j = 0;
        int m = 0;
        for (j = i; j < str.length && j < i + k; j++){
            for (m = j+1; m < str.length && m < i + k; m++){
                if (str[j] == str[m]){
                    return true;
                }
            }
        }
        return false;
    }
}