#include<iostream> #include<vector> #define maxn 6010 #define ll long long usingnamespacestd;
int n, k;
char s[maxn];
structnode { int s1, s2, len;
node(int s1 = 0, int s2 = 0, int len = 0) : s1(s1), s2(s2), len(len) {} };
vector<node> A; voidsolve(int s1, int s2){ int sum = 0, t1 = s1 - 1, t2 = s2 - 1; while (t2 < n) { ++t1; ++t2; sum += s[t1] != s[t2]; while (sum > k && s2 <= n) { A.push_back(node(s1, s2, min(s2 - s1, t1 - s1))); sum -= s[s1] != s[s2]; ++s1; ++s2; } } if (sum <= k) { while (s2 <= n) { A.push_back(node(s1, s2, min(s2 - s1, n - s2 + 1))); ++s1; ++s2; } } }
ll ans[maxn]; voidwork(){ cin >> n >> k >> s + 1; A.clear(); for (int i = 1; i <= n; ++i) ans[i] = 0; for (int i = 2; i <= n; ++i) solve(1, i); for (auto t : A) ++ans[t.s1], --ans[t.s1 + t.len]; for (int i = 1; i <= n; ++i) ans[i] += ans[i - 1]; for (auto t : A) ans[t.s2] -= t.len; for (int i = 1; i <= n; ++i) ans[i] += ans[i - 1]; for (int i = 1; i < n; ++i) cout << ans[i] << "\n"; }