n, a, b, T = map(int, input().split())
s = input()

prefsum = [0] * n
suffsum = [0] * n

for i in range(n):
    prefsum[i] = 1 if s[i] == 'h' else b
    if i > 0:
        prefsum[i] += a + prefsum[i - 1]

suffsum[-1] = a
for i in range(n - 1, -1, -1):
    suffsum[i] += 1 if s[i] == 'h' else b
    if i + 1 < n:
        suffsum[i] += a + suffsum[i + 1]

res = 0
if prefsum[-1] <= T:
    res = n
else:
    l = 1
    for r in range(n):
        l = max(l, r + 1)
        while l < n and suffsum[l] + r * a + prefsum[r] > T:
            l += 1
        if prefsum[r] > T:
            break
        res = max(res, r + 1 + n - l)

    r = 0
    for l in range(n):
        r = max(r, l + 1)
        while r < n and suffsum[r] + (n - r) * a + prefsum[l] > T:
            r += 1
        if prefsum[l] > T:
            break
        res = max(res, l + 1 + n - r)

print(res)
