#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int dp[2 * N], cnt[2 * N], n, k, l, price, ans = N;
string s;
void solve() {
  int le = 0, ri = N, sol;
  while (le < ri) {
    price = (le + ri) >> 1;
    for (int i = n - 1; i >= 0; i--) {
      dp[i] = dp[i + 1] + (s[i] >= 'a');
      cnt[i] = cnt[i + 1];
      if (dp[i + l] + price < dp[i])
        dp[i] = dp[i + l] + price, cnt[i] = cnt[i + l] + 1;
    }
    if (cnt[0] > k)
      le = price + 1;
    else
      ri = price, sol = dp[0] - price * k;
  }
  ans = min(ans, sol);
}
int main() {
  cin >> n >> k >> l >> s;
  solve();
  for (int i = 0; i < n; i++)
    if (s[i] >= 'a')
      s[i] -= 'a' - 'A';
    else
      s[i] -= 'A' - 'a';
  solve();
  printf("%i\n", ans);
  return 0;
}
