#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6;
pair<long long, int> dp[N];
int arr[N];
int n, k, l;
void solve(int C) {
  dp[n] = {0, 0};
  for (int idx = n - 1; ~idx; idx--) {
    pair<long long, int> p = dp[idx + 1];
    dp[idx] = {p.first + arr[idx], p.second};
    p = dp[min(idx + l, n)];
    dp[idx] = min(dp[idx], {p.first + C, p.second + 1});
  }
}
bool valid(int cost) {
  solve(cost);
  return dp[0].second <= k;
}
int bs(int s, int e) {
  while (s < e) {
    int mid = s + (e - s) / 2;
    if (valid(mid))
      e = mid;
    else
      s = mid + 1;
  }
  return s;
}
long long getAns() {
  int cost = bs(0, n);
  solve(cost);
  return dp[0].first - 1LL * cost * k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string str;
  cin >> n >> k >> l >> str;
  for (int i = 0; i < int(n); i++) arr[i] = bool(islower(str[i]));
  long long ans = getAns();
  for (int i = 0; i < int(n); i++) arr[i] = bool(isupper(str[i]));
  ans = min(ans, getAns());
  cout << ans << '\n';
  return 0;
}
