#include <bits/stdc++.h>
using namespace std;
const int N = 1100000;
int n, k, l, a[N];
char S[N];
struct aa {
  int x, y;
  double v;
} dp[N];
aa add_x(aa a, int b) {
  a.x += b;
  a.v += b;
  return a;
}
aa add_y(aa a, double t) {
  a.y++;
  a.v += t;
  return a;
}
aa min(aa x, aa y) {
  if (x.v < y.v)
    return x;
  else
    return y;
}
aa compute(double t) {
  for (int i = 1; i <= n; i++) {
    if (i < l) {
      dp[i] = add_x(dp[i - 1], a[i]);
    } else {
      dp[i] = min(add_x(dp[i - 1], a[i]), add_y(dp[i - l], t));
    }
  }
  return dp[n];
}
int solve() {
  double l = 0, r = 1e9;
  for (int i = 1; i <= 70; i++) {
    double mid = (l + r) / 2;
    auto ans = compute(mid);
    if (ans.y <= k)
      r = mid;
    else
      l = mid;
  }
  auto ans = compute((l + r) / 2);
  return int(round(ans.v - (l + r) / 2 * k));
}
int main() {
  scanf("%d%d%d", &n, &k, &l);
  if (1LL * k * l >= n) {
    printf("0\n");
    return 0;
  }
  scanf("%s", S + 1);
  for (int i = 1; i <= n; i++) {
    if ('a' <= S[i] && S[i] <= 'z') {
      a[i] = 0;
    } else {
      a[i] = 1;
    }
  }
  int ans = solve();
  for (int i = 1; i <= n; i++) {
    if ('a' <= S[i] && S[i] <= 'z') {
      a[i] = 1;
    } else {
      a[i] = 0;
    }
  }
  ans = min(ans, solve());
  printf("%d\n", ans);
}
