#include <bits/stdc++.h>
using namespace std;
int arr[2000005];
int n, k, l;
int dp[2000005], cnt[2000005];
pair<int, int> f(int c) {
  dp[0] = 0;
  cnt[0] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1] + arr[i];
    if (dp[i] > dp[max(i - l, 0)] + c) {
      dp[i] = dp[max(i - l, 0)] + c;
      cnt[i] = cnt[max(i - l, 0)] + 1;
    } else {
      cnt[i] = cnt[i - 1];
    }
  }
  return {dp[n], cnt[n]};
}
int sh() {
  int x = 1000000;
  for (int j = 20; j >= 0; j--) {
    int y = x - (1 << j);
    if (y < 0) continue;
    auto cv = f(y);
    if (cv.second <= k) {
      x = y;
    }
  }
  return f(x).first - x * k;
}
void solve() {
  cin >> n >> k >> l;
  string s;
  cin >> s;
  for (int i = 1; i <= n; i++) {
    arr[i] = s[i - 1] < 'a';
  }
  int ans = sh();
  for (int i = 1; i <= n; i++) arr[i] ^= 1;
  ans = min(ans, sh());
  cout << ans << endl;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
