#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int n, a, b, k;
char str[N], str2[2 * N];
int ll[N], rr[N];
int getl(int l, int r) { return ll[r] - ll[l]; }
int getr(int l, int r) { return rr[l] - rr[r]; }
int half_find1(int l, int r, int e, int k) {
  int mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (getr(mid, e) > k)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return l;
}
int half_find2(int l, int r, int s, int k) {
  int mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (getr(s, mid) < k)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return r;
}
int main() {
  while (~scanf("%d %d %d %d", &n, &a, &b, &k)) {
    memset(ll, 0, sizeof ll);
    memset(rr, 0, sizeof rr);
    getchar();
    gets(str);
    int len = 2 * n;
    int pre = str[0] == 'h' ? 0 : b;
    pre += a;
    for (int i = 0; i < n; i++) {
      str2[i] = str[i];
      str2[n + i] = str[i];
    }
    str2[len] = 0;
    ll[0] = 0;
    for (int i = 1; i < len; i++) {
      if (str2[i] != str2[i - 1]) {
        ll[i] = ll[i - 1] + a + b;
      } else
        ll[i] = ll[i - 1] + a;
    }
    rr[len - 1] = 0;
    for (int i = len - 2; i >= 0; i--) {
      if (str2[i] != str2[i + 1])
        rr[i] = rr[i + 1] + a + b;
      else
        rr[i] = rr[i + 1] + a;
    }
    int ans = 0;
    for (int i = n; i < len; i++) {
      if (getl(n, i) + pre > k) break;
      int l = half_find1(1, i, i, k - getl(n, i) - pre);
      if (i == 4) {
      }
      int tmp = max(i - l + 1, i - n + 1);
      ans = max(ans, min(tmp, n));
    };
    for (int i = 1; i < n; i++) {
      if (getr(i, n - 1) + pre > k) break;
      int r = half_find2(i, len - 1, i, k - getr(i, n - 1) - pre);
      int tmp = max(r - i + 1, n - i);
      ans = max(ans, min(tmp, n));
    }
    printf("%d\n", ans);
  }
  return 0;
}
