#include <bits/stdc++.h>
char pic[500010];
int take[500010];
long long acum1[500010], acum2[500010];
int main() {
  int n, a, b, T;
  while (scanf("%d%d%d%d", &n, &a, &b, &T) > 0) {
    scanf("%s", pic);
    for (int i = 0; i < n; i++) {
      take[i] = (pic[i] == 'h' ? 1 : b + 1);
      acum1[i] = take[i];
      if (i > 0) acum1[i] += acum1[i - 1];
    }
    for (int i = n - 1; i >= 0; i--) {
      acum2[i] = take[i];
      if (i < n - 1) acum2[i] += acum2[i + 1];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (acum1[i] + i * a > T) break;
      int lo = i + 1, up = n - 1, j = n;
      while (lo <= up) {
        int mid = (lo + up) >> 1;
        long long tmp = acum1[i] + i * a + acum2[mid] + (n - mid) * a +
                        (i < n - mid ? i : n - mid) * a;
        if (tmp > T) {
          lo = mid + 1;
        } else {
          j = mid;
          up = mid - 1;
        }
      }
      if (i + 1 + n - j > ans) ans = i + 1 + n - j;
    }
    printf("%d\n", ans);
  }
}
