#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;
  for (i = 1; i < n - 1; i++) {
    tf = t - frnt[i] - i * a;
    l = i + 1;
    r = n;
    if (tf < 0) continue;
    while (l < r) {
      mid = (l + r) / 2;
      if (bck[mid] > tf) {
        l = mid + 1;
      } else if (bck[mid] < tf && (mid - 1 != l && bck[mid - 1] <= tf)) {
        r = mid;
      } else {
        break;
      }
    }
    if (n - mid + i > cf) {
      cf = n - mid + i + 1;
    }
  }
  for (i = n - 1; i > 0; i--) {
    tf = t - bck[i] - (n - i) * a;
    l = 0;
    r = i - 1;
    if (tf < 0) continue;
    while (l < r) {
      mid = (l + r) / 2;
      if (frnt[mid] > tf) {
        r = mid - 1;
      } else if (frnt[mid] < tf && (mid + 1 != r && frnt[mid + 1] <= tf)) {
        l = mid;
      } else {
        break;
      }
    }
    if (mid + n - i > cb) cb = mid + n - i + 1;
  }
  cout << max(max(cb, cf), max(fval, bval));
  return 0;
}
