#include <bits/stdc++.h>
using namespace std;
string o;
int frnt[500009], bck[500009];
int main() {
  int i, j, n, a, b, t, tf, tmp, tcst, fval, bval = 0;
  cin >> n >> a >> b >> t;
  cin >> o;
  fval = 0;
  bck[0] = 1 + (o[0] != 'h' ? b : 0);
  frnt[0] = bck[0];
  if (frnt[0] <= t) {
    fval = bval = 1;
  }
  for (i = 1; i < n; i++) {
    tcst = a + 1;
    if (o[i] != 'h') tcst += b;
    frnt[i] = frnt[i - 1] + tcst;
    if (frnt[i] <= t) fval = i + 1;
  }
  for (i = n - 1; i > 0; i--) {
    tcst = a + 1;
    if (o[i] != 'h') tcst += b;
    bck[i] = bck[(i + 1) % n] + tcst;
    if (bck[i] < t) bval = n - i + 1;
  }
  int cf = 0, cb = 0, l, r, mid, cst, val;
  for (i = 1; i < n - 1; i++) {
    tf = t - frnt[i] - i * a + frnt[0];
    l = i + 1;
    r = n - 1;
    if (tf < 0) continue;
    val = n;
    while (l <= r) {
      mid = (l + r) / 2;
      if (bck[mid] <= tf && (val == n || bck[mid] > bck[val])) {
        val = mid;
      }
      if (bck[mid] > tf) {
        l = mid + 1;
      } else if (bck[mid] < tf) {
        r = mid - 1;
      } else {
        break;
      }
    }
    if (n - val + i + 1 > cf && val != n) {
      cf = n - val + i + 1;
    }
  }
  for (i = n - 1; i > 1; i--) {
    tf = t - bck[i] - (n - i) * a + frnt[0];
    l = 1;
    r = i - 1;
    if (tf < 0) continue;
    val = 0;
    while (l <= r) {
      mid = (l + r) / 2;
      if (frnt[mid] <= tf && (val == 0 || frnt[mid] > frnt[val])) {
        val = mid;
      }
      if (frnt[mid] > tf) {
        r = mid - 1;
      } else if (frnt[mid] < tf) {
        l = mid + 1;
      } else {
        break;
      }
    }
    if (val + n - i + 1 > cb && val != 0) {
      cb = val + n - i + 1;
    }
  }
  cout << max(max(cb, cf), max(fval, bval));
  return 0;
}
