#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int v[N], s[N], dp[N], pMax[N], cnt[N], n, k, l;
void solve(int lambda) {
  memset(dp, 0, sizeof(dp));
  memset(cnt, 0, sizeof(cnt));
  memset(pMax, 0, sizeof(pMax));
  for (int i = 1; i < l; i++) {
    dp[i] = dp[i - 1];
    cnt[i] = cnt[i - 1];
    if (i - s[i] - lambda > dp[i]) {
      dp[i] = i - s[i] - lambda;
      cnt[i] = 1;
    }
    pMax[i] = pMax[i - 1];
    if (dp[i] > dp[pMax[i]]) pMax[i] = i;
  }
  for (int i = l; i <= n; i++) {
    dp[i] = dp[i - 1];
    cnt[i] = cnt[i - 1];
    if (dp[pMax[i - l]] + l - (s[i] - s[i - l]) - lambda > dp[i]) {
      dp[i] = dp[pMax[i - l]] + l - (s[i] - s[i - l]) - lambda;
      cnt[i] = cnt[pMax[i - l]] + 1;
    }
    pMax[i] = pMax[i - 1];
    if (dp[i] > dp[pMax[i]]) pMax[i] = i;
  }
}
int findBin() {
  int st = 0, dr = n, ans = 0;
  while (st <= dr) {
    int mj = (st + dr) / 2;
    solve(mj);
    if (cnt[n] <= k) {
      ans = dp[n] + k * mj;
      dr = mj - 1;
    } else
      st = mj + 1;
  }
  return n - s[n] - ans;
}
int main() {
  string str;
  cin >> n >> k >> l >> str;
  for (int i = 0; i < n; i++) {
    if (str[i] >= 'A' && str[i] <= 'Z') v[i + 1] = 1;
    s[i + 1] = s[i] + v[i + 1];
  }
  int ans = findBin();
  for (int i = 1; i <= n; i++) {
    v[i] ^= 1;
    s[i] = s[i - 1] + v[i];
  }
  cout << min(ans, findBin());
}
