import java.util.*;
import java.io.*;

public class TaskD {
    private FastScanner in;
    private PrintWriter out;


    public void solve() throws IOException {
        int n = in.nextInt();
        long a = in.nextInt(), b = in.nextInt(), t = in.nextInt();
        boolean[] vert1 = new boolean[2 * n];
        boolean[] vert2 = new boolean[2 * n];
        int cur = 0;
        int cur2 = n;
        for (char c : in.next().toCharArray()) {
            vert1[cur] = c == 'h';
            vert1[cur + n] = vert1[cur];
            vert2[cur2] = c == 'h';
            if (cur2 + n < 2 * n) {
                vert2[cur2 + n] = vert2[cur2];
            }
            cur++;
            cur2--;
        }
        vert2[0] = vert2[n];
        n = 2 * n;
        long res = Math.max(ans(n, a, b, t, vert1), ans(n, a, b, t, vert2));
        out.println(res);
    }
    public long ans(int n, long a, long b, long t, boolean[] vert) throws IOException {


        long[] sum = new long[n];
        sum[0] = 1L + (vert[0] ? 0 : b);
        for (int i = 1; i < n; i++) {
            sum[i] = sum[i - 1] + 1L + (vert[i] ? 0L : b);
        }
        int start = n / 2;
        long ans = 0;
        for (int i = start; i < n; i++) {
            long res = sum[i] - sum[start - 1] + a * (i - start);
            long rem = t - res;
            if (rem < 0) {
                continue;
            }
            int l = 0, r = n;
            while (r - l > 1) {
                int mid = (l + r) / 2;
                int leftIndex = Math.max(0, i - mid);

                long curSum = sum[start - 1] - (leftIndex == 0 ? 0L : sum[leftIndex - 1]) + a * (i - leftIndex);
                if (leftIndex >= start) {
                    curSum = rem + 1;
                }
                if (curSum <= rem) {
                    l = mid;
                } else {
                    r = mid;
                }
            }
            int leftIndex = Math.max(0, i - l);
            long curSum = sum[start - 1] - (leftIndex == 0 ? 0L : sum[leftIndex - 1]) + a * (i - leftIndex);
            if (leftIndex >= start) {
                if (res <= t) {
                    ans = Math.max(ans, i - start + 1);
                }
             } else {
                if (curSum + res <= t) {
                    ans = Math.max(ans, i - leftIndex + 1);
                }
            }

        }
        return Math.min(ans, n / 2);
    }

    public void run() {
        try {
            in = new FastScanner();
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

    }

    public static void main(String[] arg) {
        new TaskD().run();
    }
}