#include <bits/stdc++.h>
using namespace std;
int n, i, a, b, c, l, r, mid, ans, now;
char s[1000010];
long long sum1[500010], sum2[500010];
inline bool check(int x) {
  if (x <= n) {
    if (sum1[x - 1] <= c || sum2[x - 1] <= c) return 1;
  }
  for (int i = 0; i <= min(x - 1, n - 1); i++)
    if (sum1[i] + sum2[x - i - 1] + min(x - i - 1, i) * a - sum1[0] <= c)
      return 1;
  return 0;
}
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &c);
  scanf("%s", s + n);
  for (i = 0; i < n; i++) s[i] = s[i + n];
  if (s[n] == 'w')
    sum1[0] = sum2[0] = b + 1;
  else
    sum1[0] = sum2[0] = 1;
  for (i = 1; i < n; i++) {
    if (s[n + i] == 'h')
      sum1[i] = sum1[i - 1] + a + 1;
    else
      sum1[i] = sum1[i - 1] + a + b + 1;
    if (s[n - i] == 'h')
      sum2[i] = sum2[i - 1] + a + 1;
    else
      sum2[i] = sum2[i - 1] + a + b + 1;
  }
  r = n;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  printf("%d", ans);
  return 0;
}
