#include <bits/stdtr1c++.h>

#define MAX 500010
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define dbg(x) cout << #x << " = " << x << endl
#define ran(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))

using namespace std;

char str[MAX];
long long n, a, b, t, ar[MAX], P[MAX], S[MAX];

long long F(long long i, long long x){
    long long j, k, l, res, low, high, mid;

    low = i + 1, high = n;
    while ((low + 1) < high){
        mid = (low + high) >> 1;
        if ((S[mid] + x) <= t) high = mid;
        else low = mid;
    }

    if ((S[low] + x) <= t) return (n - low + 1);
    if ((S[high] + x) <= t) return (n - high + 1);
    return 0;
}

int main(){
    long long i, j, k, l, c, x,  res;

    while (scanf("%lld %lld %lld %lld", &n, &a, &b, &t) != EOF){
        scanf("%s", str);

        clr(ar);
        for (i = 1; i <= n; i++) ar[i] = (str[i - 1] == 'h');

        x = 0;
        for (i = 1; i <= n; i++){
            if (ar[i] == 0) x += b;
            x++;
            P[i] = x;
            x += a;
        }

        x = 0;
        for (i = n; i >= 1; i--){
            if (ar[i] == 0) x += b;
            x++;
            S[i] = x;
            if ((P[1] + a + S[i]) <= t && i > 1) res = max(res, n - i + 2);
            x += a;
        }

        res = 0;
        for (i = 1; i <= n; i++){
            if (P[i] <= t) res = max(res, i);
            x = P[i] + (a * i), c = i;
            if (x <= t){
                if (i != n) c += F(i, x);
                if (c > res) res = c;
            }
        }

        /*for (i = n; i >= 1; i--){
            x = S[i] + a, c = n - i + 1;
            if (x <= t){
                if (i != 1){
                    long long low =
                }
            }
        }*/

        printf("%lld\n", res);
    }
    return 0;
}
