#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target_tbl( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <class T>
void show(const vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << '\n';
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());
long long xx[8] = {1, -1, 0, 0, 1, -1, 1, -1};
long long yy[8] = {0, 0, 1, -1, -1, -1, 1, 1};
string dir = "RDLU";
string travel = "ENWS";
const long long N = 1e5 + 50, oo = 1e18 + 500;
const long long mod = 998244353;
const long long M2 = 1000000093, x2 = 27162;
const long long M1 = 1000000087, x1 = 241;
const long double eps = 1e-18, PI = 2 * acos(0.0);
long long cnt = 0;
vector<set<long long>> g;
vector<long long> visit;
pair<long long, long long> check(vector<long long> &a, long long l,
                                 long long lambda) {
  long long n = ((long long)(a.size()));
  vector<pair<long long, long long>> dp(n + 1, {oo, oo});
  dp[0] = {0, 0};
  for (long long i = 0; i < n; i++) {
    {
      pair<long long, long long> pr = {dp[i].first + a[i], dp[i].second};
      dp[i + 1] = min(dp[i + 1], pr);
      ;
    }
    {
      long long j = min(i + l, n);
      pair<long long, long long> pr = {dp[i].first + lambda, dp[i].second + 1};
      dp[j] = min(dp[j], pr);
      ;
    }
  }
  return dp[n];
}
long long solve(vector<long long> &a, long long k, long long l) {
  long long n = ((long long)(a.size()));
  long long lb = -1, rb = n + 10;
  while (rb - lb > 1) {
    long long lambda = (lb + rb) >> 1;
    pair<long long, long long> pr = check(a, l, lambda);
    if (pr.second <= k) {
      rb = lambda;
    } else {
      lb = lambda;
    }
  }
  pair<long long, long long> pr = check(a, l, rb);
  return pr.first - k * rb;
}
signed main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  long long n, k, l;
  cin >> n >> k >> l;
  string s;
  cin >> s;
  vector<vector<long long>> a(2, vector<long long>(n));
  for (long long i = 0; i < n; i++) {
    a[0][i] = (islower(s[i]) ? 1 : 0);
    a[1][i] = (isupper(s[i]) ? 1 : 0);
  }
  long long ans = min(solve(a[0], k, l), solve(a[1], k, l));
  cout << ans;
}
