from bisect import bisect_left

def cost(prev, cur_step, time_to_turn):
    if cur_step == 'h':
        return prev + 1
    else:
        return prev + 1 + time_to_turn

def find_ge(a, x):
    i = bisect_left(a, x)
    if i:
        return i
    return -1

param = list(map(lambda x: int(x), input().split()))
n, a, b, time = param[0], param[1], param[2], param[3]

photos = list(input())

seen = []

now_seen = 0
prev_cost = 0
for i, p in enumerate(photos):
    if i > 0:
        prev_cost += a
    else:
        prev_cost = 0

    cur_cost = cost(prev_cost, p, b)
    if cur_cost <= time:
        seen.append(0)
        now_seen += 1
        seen[i] = time - cur_cost
        prev_cost = cur_cost
    else:
        break

now_seen = 0
seen_reversed = []
photos.append(photos.pop(0))
for i, p in enumerate(reversed(photos)):
    if i > 0:
        prev_cost += a
    else:
        prev_cost = a

    cur_cost = cost(prev_cost, p, b)
    if cur_cost <= time:
        seen_reversed.append(0)
        now_seen += 1
        seen_reversed[i] = time - cur_cost
        prev_cost = cur_cost
    else:
        break

if len(seen) == n or len(seen_reversed) == n:
    print(n)
    exit()

max_cur = max(len(seen), len(seen_reversed))

longer = seen if len(seen) == max_cur else seen_reversed
shorter = list(reversed(seen if len(seen_reversed) == max_cur else seen_reversed))
fix = a if len(seen) == max_cur else 0


for i, s in enumerate(reversed(longer)):
    rem = s + i - len(longer) + fix
    if rem <= 0:
        continue

    other = len(shorter) - find_ge(shorter, time - rem) - 1
    if other == -1:
        continue

    max_cur = max(max_cur, len(seen) - i + other)

print(max_cur)