#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double eps = (1e-10);
int isGreater(long double x, long double y) {
  if (abs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
int n, k, l;
const int MAX_N = 1e6 + 3;
int a[MAX_N];
pair<int, int> dp[MAX_N];
pair<int, int> solve(int penalty) {
  for (int i = n - 1; i >= 0; --i) {
    dp[i] = {dp[i + 1].first + a[i], dp[i + 1].second};
    auto temp = dp[min(i + l, n)];
    temp.first = temp.first + penalty;
    temp.second++;
    dp[i] = min(dp[i], temp);
  }
  return dp[0];
}
bool valid(int penalty) {
  auto temp = solve(penalty);
  return temp.second <= k;
}
int getAns() {
  int st = 0, en = MAX_N;
  while (st < en) {
    int mid = st + (en - st) / 2;
    if (valid(mid))
      en = mid;
    else
      st = mid + 1;
  }
  auto temp = solve(st);
  int ans = temp.first, cnt = temp.second;
  cerr << "cnt"
       << " : " << (cnt) << endl;
  cerr << "ans"
       << " : " << (ans) << endl;
  cerr << "st"
       << " : " << (st) << endl;
  return min(ans - cnt * st, ans - k * st);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> n >> k >> l >> s;
  for (int i = 0; i < (int)(s).size(); ++i) a[i] = (bool)(islower(s[i]));
  int ans = getAns();
  for (int i = 0; i < (int)(s).size(); ++i) a[i] = (bool)(isupper(s[i]));
  ans = min(ans, getAns());
  cout << ans << '\n';
  return 0;
}
