#include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}
const int N = 1e6 + 7;
int n, k, l, T[N];
pair<long long, long long> dp[N];
pair<long long, long long> calc(long long lam) {
  dp[0] = {0, 0};
  for (int i = 1; i <= n; i++) {
    dp[i] = {dp[i - 1].first + T[i], dp[i - 1].second};
    dp[i] = min(dp[i],
                {dp[max(0, i - l)].first + lam, dp[max(0, i - l)].second + 1});
  }
  return dp[n];
}
int solve() {
  int le = -1, ri = n + 1;
  int ans = n;
  while (le + 1 < ri) {
    int m = (le + ri) / 2;
    auto p = calc(m);
    if (p.second <= k)
      ri = m;
    else
      le = m;
  }
  auto p = calc(ri);
  return p.first - k * ri;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> l;
  string buf;
  cin >> buf;
  for (int i = 1; i <= n; i++) T[i] = ('a' <= buf[i - 1] && buf[i - 1] <= 'z');
  int ans = solve();
  for (int i = 1; i <= n; i++) T[i] = ('A' <= buf[i - 1] && buf[i - 1] <= 'Z');
  ans = min(ans, solve());
  cout << ans << "\n";
  return 0;
}
