#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000006;
const long long MOD = 1000000007;
int n, k, l;
bool s[MAXN];
long long dp[MAXN], chg[MAXN];
pair<long long, long long> cost(long long p) {
  for (long long i = 1; i <= n; i++) {
    dp[i] = dp[i - 1] + s[i];
    chg[i] = chg[i - 1];
    if (i >= l) {
      if (dp[i - l] + l - p > dp[i]) {
        dp[i] = dp[i - l] + l - p;
        chg[i] = chg[i - l] + 1;
      }
    } else {
      if (i - p > dp[i]) {
        dp[i] = i - p;
        chg[i] = 1;
      }
    }
  }
  return {chg[n], dp[n]};
}
int solve() {
  pair<long long, long long> c0 = cost(0);
  ;
  if (c0.first <= k) {
    return c0.second;
  }
  long long L = l + 1, R = 0;
  while (R < L - 1) {
    long long M = (L + R) >> 1;
    pair<long long, long long> res = cost(M);
    if (res.first > k) {
      R = M;
    } else {
      L = M;
    }
  }
  pair<long long, long long> Lres, Rres;
  Lres = cost(L);
  Rres = cost(R);
  Lres.second += Lres.first * L;
  Rres.second += Rres.first * R;
  for (int i = 0; i <= l + 1; i++) {
    ;
  }
  if (Lres.first == k) {
    return Lres.second;
  } else {
    ;
    long long a = k - Lres.first;
    long long b = Rres.first - k;
    return (a * Rres.second + b * Lres.second) / (a + b);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> k >> l;
  for (int i = 1; i <= n; ++i) {
    char c;
    cin >> c;
    s[i] = islower(c);
  }
  int ans = solve();
  for (int i = 1; i <= n; ++i) {
    s[i] = !s[i];
  }
  ans = max(ans, solve());
  cout << n - ans << '\n';
}
