#include <bits/stdc++.h>
using namespace std;
long long f[500005], g[500005];
int n, a, b, t;
string s;
bool check(int x) {
  if (!x) return true;
  long long i, w;
  for (i = 1; i <= x; i++) {
    w = f[i] + g[n - (x - i) + 1] - f[1] + a * min(i - 1, x - i);
    if (s[i] != s[n - (x - i) + 1]) w += b;
    if (w <= t) return true;
  }
  return false;
}
int main() {
  int i, l, r, m;
  scanf("%d%d%d%d", &n, &a, &b, &t);
  cin >> s;
  s = " " + s;
  if (s[1] == 'h')
    f[1] = 1;
  else
    f[1] = b + 1;
  for (i = 2; i <= n; i++) {
    f[i] = f[i - 1] + a + 1;
    if (s[i] != s[i - 1]) f[i] += b;
  }
  if (s[n] != s[1])
    g[n] = f[1] + a + b + 1;
  else
    g[n] = f[1] + a + 1;
  for (i = n - 1; i > 1; i--) {
    if (s[i] != s[i + 1])
      g[i] = g[i + 1] + a + b + 1;
    else
      g[i] = g[i + 1] + a + 1;
  }
  l = 0;
  r = n;
  while (l <= r) {
    m = (l + r) / 2;
    if (check(m))
      l = m + 1;
    else
      r = m - 1;
  }
  printf("%d\n", l - 1);
  return 0;
}
