#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, k, L, a[N];
char s[N];
long long ans;
pair<long long, int> f[N];
template <class I>
inline void ckMin(I& p, I q) {
  p = (p < q ? p : q);
}
inline void ck(const int mid) {
  f[0] = make_pair(0, 0);
  for (register int i = 1; i <= n; ++i)
    f[i] = f[i - 1], f[i].first += a[i],
    i <= L ? ckMin(f[i], make_pair((long long)mid, 1))
           : ckMin(f[i], make_pair(f[i - L].first + mid, f[i - L].second + 1));
}
inline void ms() {
  register int l = 0, r = n, mid, x = 0;
  while (l <= r)
    mid = l + r >> 1, ck(mid), f[n].second <= k ? x = mid,
    r = mid - 1 : l = mid + 1;
  ck(x), ckMin(ans, f[n].first - (0ll + x) * k);
}
int main() {
  scanf("%d%d%d%s", &n, &k, &L, s + 1), ans = 8e18;
  register int i;
  for (i = 1; i <= n; ++i) a[i] = s[i] >= 'a' && s[i] <= 'z';
  for (ms(), i = 1; i <= n; ++i) a[i] ^= 1;
  ms(), printf("%lld", ans);
  return 0;
}
