#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int d[2 * N], c[2 * N], n, k, l, p, a = N, q, w, u;
string s;
int main() {
  cin >> n >> k >> l >> s;
  q = 0;
  w = N;
  while (q < w) {
    p = (q + w) >> 1;
    for (int i = n - 1; i >= 0; i--) {
      d[i] = d[i + 1] + (s[i] > 96);
      c[i] = c[i + 1];
      if (d[i + l] + p < d[i]) d[i] = d[i + l] + p, c[i] = c[i + l] + 1;
    }
    if (c[0] > k)
      q = p + 1;
    else
      w = p, u = d[0] - p * k;
  }
  a = min(a, u);
  for (auto &p : s) p = (p + 32) % 125;
  q = 0;
  w = N;
  while (q < w) {
    p = (q + w) >> 1;
    for (int i = n - 1; i >= 0; i--) {
      d[i] = d[i + 1] + (s[i] > 96);
      c[i] = c[i + 1];
      if (d[i + l] + p < d[i]) d[i] = d[i + l] + p, c[i] = c[i + l] + 1;
    }
    if (c[0] > k)
      q = p + 1;
    else
      w = p, u = d[0] - p * k;
  }
  a = min(a, u);
  printf("%i\n", a);
}
