import sys

def search_not_more(a, max_value):
    l, r = 0, len(a)
    if a[0] > max_value:
        return 0
    while l + 1 < r:
        m = (r + l) / 2
        if a[m] <= max_value:
            l = m
        else:
            r = m
    return l + 1

n, a, b, T = map(int, sys.stdin.readline().split())
time_per_photo = [
    1 if c == 'h' else 1 + b
    for c in sys.stdin.readline().strip()
]
T -= time_per_photo[0]
if T < 0:
    print 0
    sys.exit(0)
r = [0] * n
for i in range(n):
    r[i] = time_per_photo[i] + a + r[i - 1] if i > 0 else 0
l = [0] * n
for i in range(n):
    l[i] = time_per_photo[(n - i) % n] + a + l[i - 1] if i > 0 else 0

answer = 0
for i in range(n):
    if T >= (l[i] + i * a):
        answer = max(
            answer,
            min(search_not_more(r, T - (l[i] + i * a)) + i, n)
        )
    if T >= (r[i] + i * a):
        answer = max(
            answer,
            min(search_not_more(l, T - (r[i] + i * a)) + i, n)
        )

print answer
