#include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 1000 + 11;
const int INF = 1e9;
int n, k, l;
string s;
int a[N];
pair<int, int> dp[N];
int calc(int mid) {
  for (int i = 0; i <= n; ++i) {
    dp[i] = make_pair(INF, INF);
  }
  dp[0] = make_pair(0, 0);
  for (int i = 0; i < n; ++i) {
    if (dp[i + 1] > make_pair(dp[i].first + a[i], dp[i].second)) {
      dp[i + 1] = make_pair(dp[i].first + a[i], dp[i].second);
    }
    if (dp[min(n, i + l)] > make_pair(dp[i].first + mid, dp[i].second + 1)) {
      dp[min(n, i + l)] = make_pair(dp[i].first + mid, dp[i].second + 1);
    }
  }
  return dp[n].second;
}
int solve() {
  int l = 0, r = n;
  int res = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (calc(mid) > k) {
      l = mid + 1;
      res = mid;
    } else {
      r = mid - 1;
    }
  }
  if (calc(res) <= k) return 0;
  calc(res + 1);
  return dp[n].first - (res + 1) * 1ll * k;
}
int main() {
  cin >> n >> k >> l >> s;
  for (int i = 0; i < n; ++i) {
    a[i] = islower(s[i]) > 0;
  }
  int ans = INF;
  ans = min(ans, solve());
  for (int i = 0; i < n; ++i) {
    a[i] = isupper(s[i]) > 0;
  }
  ans = min(ans, solve());
  cout << ans << endl;
  return 0;
}
