#include <bits/stdc++.h>
using namespace std;
int n, a, b, T;
int ans, sum[1000010];
char s[1000010];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> T >> s + 1;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1];
    sum[i] += (s[i] == 'h' ? 1 : 1 + b);
  }
  for (int i = n + 1; i <= 2 * n; i++) {
    sum[i] = sum[i - 1];
    sum[i] += (s[i - n] == 'h' ? 1 : 1 + b);
  }
  int l = 1, r = n + 1;
  while (l <= n && r <= 2 * n) {
    while (r - l + 1 > n ||
           sum[r] - sum[l - 1] + (r - l + min(r - n - 1, n - l + 1)) * a > T)
      l++;
    ans = max(ans, r - l + 1);
    r++;
  }
  cout << ans;
  return 0;
}
