#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
int n, l, k, a[maxn], Ans;
string s;
int dp[maxn], cnt[maxn];
int solve(int cost) {
  memset(dp, 0, sizeof dp);
  memset(cnt, 0, sizeof cnt);
  for (int y = 1; y <= n; y++) {
    dp[y] = dp[y - 1] + a[y];
    cnt[y] = cnt[y - 1];
    if (dp[max(0, y - l)] + cost < dp[y])
      dp[y] = cost + dp[max(0, y - l)], cnt[y] = cnt[max(0, y - l)] + 1;
  }
  return cnt[n];
}
int Bs(int i, int j) {
  if (i + 1 == j) return j;
  int md = (i + j) >> 1;
  if (solve(md) > k)
    return Bs(md, j);
  else
    return Bs(i, md);
}
int main() {
  cin >> n >> k >> l >> s;
  Ans = n;
  for (int y = 1; y <= n; y++) a[y] = (s[y - 1] < 'a');
  int po;
  po = Bs(-1, n + 2);
  solve(po);
  Ans = min(Ans, dp[n] - k * po);
  for (int y = 1; y <= n; y++) a[y] ^= 1;
  po = Bs(-1, n + 2);
  solve(po);
  Ans = min(Ans, dp[n] - k * po);
  cout << Ans;
  return 0;
}
