#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
void print() { cout << '\n'; }
template <typename T, typename... Ts>
void print(const T& value, const Ts&... values) {
  cout << value << ' ';
  print(values...);
}
long long n, lim, len;
array<bool, N> a;
pair<long long, long long> dp[N];
pair<long long, long long> solve(long long pen) {
  memset(dp, 127, sizeof(dp));
  dp[0] = make_pair(0, 0);
  deque<pair<long long, long long> > dq;
  dq.push_back(make_pair(dp[0].first, 0LL));
  for (long long i = (1); i <= (n); i++) {
    while (!dq.empty() && i - dq.front().second > len) dq.pop_front();
    if (!dq.empty()) {
      auto [val, pos] = dq.front();
      dp[i] = min(dp[i], make_pair(dp[pos].first + pen, dp[pos].second + 1));
    }
    dp[i] = min(dp[i], make_pair(dp[i - 1].first + a[i], dp[i - 1].second));
    while (!dq.empty() && dq.back().first >= dp[i].first) dq.pop_back();
    dq.push_back(make_pair(dp[i].first, i));
  }
  return dp[n];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> lim >> len;
  for (long long i = (1); i <= (n); i++) {
    char c;
    cin >> c;
    a[i] = isupper(c);
  }
  auto binSearch = [&]() {
    long long l = 0, r = 1e6 + 1;
    while (l != r) {
      long long mid = (l + r) / 2;
      auto [val, use] = solve(mid);
      if (use > lim)
        l = mid + 1;
      else
        r = mid;
    }
    auto rec = solve(l);
    return max(0LL, rec.first - lim * l);
  };
  long long ans = 1e18;
  ans = min(ans, binSearch());
  for (long long i = (1); i <= (n); i++) a[i] = 1 - a[i];
  ans = min(ans, binSearch());
  cout << ans << '\n';
}
