#include <bits/stdc++.h>
using namespace std;
int binary_search(int right_cost[], int key, int low, int high) {
  int mid = (low + high) / 2;
  if (low > high)
    return (0);
  else if (right_cost[mid] == key)
    return mid;
  else if (right_cost[mid] > key)
    return binary_search(right_cost, key, low, mid - 1);
  else if (right_cost[mid] < key)
    return max(mid, binary_search(right_cost, key, mid + 1, high));
}
int main() {
  int n, a, b, t;
  cin >> n >> a >> b >> t;
  int left_cost[n + 1], right_cost[n + 1];
  left_cost[0] = right_cost[0] = 0;
  string s;
  cin >> s;
  for (int i = 1; i <= n; ++i) {
    if (i != 1)
      left_cost[i] = a;
    else
      left_cost[i] = 0;
    if (s[i - 1] == 'h') {
      left_cost[i] += 1 + left_cost[i - 1];
    } else {
      left_cost[i] += 1 + b + left_cost[i - 1];
    }
  }
  for (int i = 1; i <= n; ++i) {
    right_cost[i] = a;
    if (s[n - i] == 'h') {
      right_cost[i] += 1 + right_cost[i - 1];
    } else {
      right_cost[i] += 1 + b + right_cost[i - 1];
    }
  }
  int maximum = 0;
  int search = 0;
  for (int i = 1; i <= n; ++i) {
    search = t - left_cost[i] - (a * (i - 1));
    if (search > 0)
      maximum =
          max(maximum, i + min(n - i, binary_search(right_cost, search, 1, n)));
  }
  cout << maximum << endl;
}
