import sun.reflect.generics.tree.Tree;

import java.io.*;
import static java.lang.Math.*;

import java.net.Inet4Address;
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter writer = new PrintWriter(System.out, true);
        PrintWriter debug = new PrintWriter(System.err, true);
        new Solution(new InputReader(System.in), writer, debug).solve();
        writer.close();
    }
}

class InputReader {
    static InputReader In = null;
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        if (In != null) throw new RuntimeException();
        In = this;
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public byte nextByte() {
        return Byte.parseByte(next());
    }
}

class Solution {
    int f(long[] left, long[] right, long a, long t){
        int n = left.length;
/*        for (int i = 0; i < n; i++){
            out.print(left[i] + " ");
        }
        out.println();
        for (int i = 0; i < n; i++){
            out.print(right[i] + " ");
        }
        out.println();*/

        int result = 1;
        for (int i = 1; i < n; i++) {
            //out.print(t - right[i] + " ");
            if (t - right[i] >= 0)
                result = max(result, i + 1);

            long x = t - (right[i] + i * a);
            if (x < 0) continue;
            if (i == n - 1) continue;

            int l = i, r = n - 1;
            //out.println("b" + l + " " + r);
            while (r - l > 1) {
                int m = (l + r) / 2;
                //out.print(m + " ");
                long sum = left[m];
                if (sum <= x) {
                    r = m;
                } else {
                    l = m;
                }
            }
            //out.println();
            if (left[r] <= x)
                result = max(result, i + (n - r) + 1);
        }
        //out.println();
        return result;
    }

    long[] rev(long[] a){
        long[] x = new long[a.length];
        int n = a.length;
        for (int i = 1; i < n; i++)
            x[n - i] = a[i];
        return x;
    }


/*

    int brute(char[] s, long t, long b){
        for (int i = 0; i < s.length; i++){
            for (int j = 0; j < s.length; j++){
                long count = t;
                int k = 0;
                if (s[0] == 'h') count--;
                else count -= b + 1;

                for (; k <= i; k++){

                }
            }
        }
    }
*/

    public void solve() {
        int n = in.nextInt();
        long a = in.nextInt();
        long b = in.nextInt();
        long t = in.nextInt();
        char[] s = in.next().toCharArray();
        long[] right = new long[n];
        for (int i = 1; i < n; i++) {
            right[i] += right[i - 1];
            right[i] += a;
            if (s[i] == 'h') right[i]++;
            else right[i] += b + 1;
        }
        long[] left = new long[n];
        for (int i = n - 1; i > 0; i--) {
            left[i] += left[(i + 1) % n];
            left[i] += a;
            if (s[i] == 'h') left[i]++;
            else left[i] += b + 1;
        }
        if (s[0] == 'h') t--;
        else t -= b + 1;
        if (t < 0) {
            out.println(0);
            return;
        }

        int result = max(f(left, right, a, t), f(rev(right), rev(left), a, t));
        out.println(result);
    }

    private InputReader in;
    private PrintWriter out;
    private PrintWriter debug;

    Solution(InputReader in, PrintWriter out, PrintWriter debug) {
        this.in = in;
        this.out = out;
        this.debug = debug;
    }
}