#include <bits/stdc++.h>
using namespace std;
int r[500100];
int l[500100];
int a, b, t, n;
int res(int rr, int ll) {
  return min(r[rr] + a * (rr + 1) + l[ll] - l[0] - a,
             l[ll] + a * (n - ll) + r[rr] - r[0] - a);
}
int main() {
  cin >> n;
  cin >> a >> b >> t;
  string s;
  cin >> s;
  int br = 0;
  int now = 0;
  for (int i = 0; i < n; i++) {
    now += (s[i] == 'h') ? 1 : (b + 1);
    if (now <= t) {
      br = max(br, i + 1);
    } else
      break;
    now += a;
  }
  now = (s[0] == 'h') ? 1 : (b + 1);
  now += a;
  for (int i = n - 1; i >= 1; i--) {
    now += (s[i] == 'h') ? 1 : (b + 1);
    if (now <= t) {
      br = max(br, n - i + 1);
    } else
      break;
    now += a;
  }
  r[0] = (s[0] == 'h') ? 1 : (b + 1);
  for (int i = 1; i < n; i++) {
    r[i] = r[i - 1] + a + ((s[i] == 'h') ? 1 : (b + 1));
  }
  l[0] = r[0];
  for (int i = n - 1; i >= 1; i--) {
    l[i] = l[(i + 1) % n] + a + ((s[n - 1] == 'h') ? 1 : (b + 1));
  }
  for (int i = 1; i < n; i++) {
    if (r[i] > t) {
      break;
    }
    int lx = i;
    int rx = n;
    while (lx + 1 < rx) {
      int m = (lx + rx) / 2;
      if (res(i, m) <= t)
        rx = m;
      else
        lx = m;
    }
    br = max(br, i + 1 + n - rx);
  }
  cout << br;
  return 0;
}
