#include <bits/stdc++.h>

using namespace std;
const int maxn = 5e5 + 500;
int n , a , b , T , st[maxn];
char str[maxn];
long long dpL[maxn] , dpR[maxn];

/*
w -> 0 , h -> 1;
初始时是 h -> 1
*/

inline void updata( long long & x , long long v) {
	x = min( x , v );
}

void init(){
    long long add = 0;
	for(int i = 1 ; i <= n ; ++ i){
		if(st[i]==0) add += b ;
		add ++;
		dpR[i] = add;
		add += a;
	}
	for(int i = 1 ; i <= n ; ++ i) dpL[i]=1LL<<60;
	int idx = n;
	dpL[1]=a+1;
	if(st[n]==0) dpL[1]+=b;
	for(int i = 1 ; i < n ; ++ i){
		if(st[idx-1]==0) updata(dpL[i+1],dpL[i]+a+b+1);
		else updata(dpL[i+1],dpL[i]+a+1);
	    idx--;
	}
}

void init2(){
	long long add = 0;
	int idx = 1;
	for(int i = 1 ; i <= n ; ++ i){
		if(st[idx]==0) add += b ;
		add ++;
		dpL[i] = add;
		add += a;
		idx--;
		if(idx == 0) idx = n;
	}
	dpR[0]=0;
	for(int i = 1 ; i <= n ; ++ i) dpR[i]=1LL<<60;
	dpR[1]=a+1;
	if(st[2]==0) dpR[1]+=b;
	for(int i = 1 ; i < n ; ++ i){
		if(st[i+1]==0) updata(dpR[i+1],dpR[i]+a+b+1);
		else updata(dpR[i+1],dpR[i]+a+1);
	}
}

int my_binary(long long rp , int limit){
	if(rp < 0) return 0;
	int l = 0 , r = limit;
	while( l < r ){
		int mid = l + r + 1 >> 1;
		if(dpL[mid] > rp) r = mid - 1;
		else l = mid;
	}
	return l;
}

int my_binary2(long long rp , int limit){
	if(rp < 0) return 0;
	int l = 0 , r = limit;
	while( l < r ){
		int mid = l + r + 1 >> 1;
		if(dpR[mid] > rp) r = mid - 1;
		else l = mid;
	}
	return l;
}

int main(int argc,char *argv[]){
	scanf("%d%d%d%d%s",&n,&a,&b,&T,str+1);
	for(int i = 1 ; i <= n ; ++ i) if(str[i]=='w') st[i] = 0 ; else st[i] = 1;
	init();
    int ans = 0;
    for(int r = 1 ; r <= n ; ++ r){
    	if(dpR[r]>T) break;
    	else{
    		int rp = T - dpR[r];
    		int pos = my_binary( rp - 1LL * a * ( r - 1 ) , n - r);
    		ans = max( ans , r + pos );
    	}
    }
    init2();
    for(int l = 1 ; l <= n ; ++ l){
    	if(dpL[l]>T) break;
    	else{
    		int rp = T - dpL[l];
    		int pos = my_binary2( rp - 1LL * a * ( l - 1 ) , n - l);
    		ans = max( ans , l + pos );
    	}
    }
    printf("%d\n",ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int maxn = 5e5 + 500;
int n , a , b , T , st[maxn];
char str[maxn];
long long dpL[maxn] , dpR[maxn];

/*
w -> 0 , h -> 1;
初始时是 h -> 1
*/

inline void updata( long long & x , long long v) {
	x = min( x , v );
}

void init(){
    long long add = 0;
	for(int i = 1 ; i <= n ; ++ i){
		if(st[i]==0) add += b ;
		add ++;
		dpR[i] = add;
		add += a;
	}
	for(int i = 1 ; i <= n ; ++ i) dpL[i]=1LL<<60;
	int idx = n;
	dpL[1]=a+1;
	if(st[n]==0) dpL[1]+=b;
	for(int i = 1 ; i < n ; ++ i){
		if(st[idx-1]==0) updata(dpL[i+1],dpL[i]+a+b+1);
		else updata(dpL[i+1],dpL[i]+a+1);
	    idx--;
	}
}

void init2(){
	long long add = 0;
	int idx = 1;
	for(int i = 1 ; i <= n ; ++ i){
		if(st[idx]==0) add += b ;
		add ++;
		dpL[i] = add;
		add += a;
		idx--;
		if(idx == 0) idx = n;
	}
	dpR[0]=0;
	for(int i = 1 ; i <= n ; ++ i) dpR[i]=1LL<<60;
	idx = 2;
	dpR[1]=a+1;
	if(st[n]==0) dpR[1]+=b;
	for(int i = 1 ; i < n ; ++ i){
		if(st[idx]==0) updata(dpR[i+1],dpR[i]+a+b+1);
		else updata(dpR[i+1],dpR[i]+a+1);
	    idx++;
	}
}

int my_binary(long long rp , int limit){
	if(rp < 0) return 0;
	int l = 0 , r = limit;
	while( l < r ){
		int mid = l + r + 1 >> 1;
		if(dpL[mid] > rp) r = mid - 1;
		else l = mid;
	}
	return l;
}

int my_binary2(long long rp , int limit){
	if(rp < 0) return 0;
	int l = 0 , r = limit;
	while( l < r ){
		int mid = l + r + 1 >> 1;
		if(dpR[mid] > rp) r = mid - 1;
		else l = mid;
	}
	return l;
}

int main(int argc,char *argv[]){
	scanf("%d%d%d%d%s",&n,&a,&b,&T,str+1);
	for(int i = 1 ; i <= n ; ++ i) if(str[i]=='w') st[i] = 0 ; else st[i] = 1;
	init();
    int ans = 0;
    for(int r = 1 ; r <= n ; ++ r){
    	if(dpR[r]>T) break;
    	else{
    		int rp = T - dpR[r];
    		int pos = my_binary( rp - 1LL * a * ( r - 1 ) , n - r);
    		ans = max( ans , r + pos );
    	}
    }
    init2();
    for(int l = 1 ; l <= n ; ++ l){
    	if(dpL[l]>T) break;
    	else{
    		int rp = T - dpL[l];
    		int pos = my_binary2( rp - 1LL * a * ( l - 1 ) , n - l);
    		ans = max( ans , l + pos );
    	}
    }
    printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ary[550000],sum[550000];
main(){
    int n,a,b,t,i;
    scanf("%d%d%d%d",&n,&a,&b,&t);
    for(i=0;i<n;i++){
        char c;
        scanf(" %c",&c);
        if(c=='h')ary[i]=(i==0)?1:a+1;
        else ary[i]=(i==0)?b+1:a+b+1;
    }
    sum[0]=0;
    for(i=n-1;i>=0;i--)sum[n-i]=ary[i]+sum[n-i-1];
    int ans=0;
    for(i=0;i<n;i++){
        t-=ary[i];
        if(t<0)break;
        int L=0,R=n;
        if(sum[R]<=t)ans=R;
        else{
            while(R-L>1){
                int M=(L+R)/2;
                if(sum[M]<=t)L=M;
                else R=M;
            }
            ans=max(ans,i+1+L);
        }
    }
    printf("%d\n",min(ans,n));
}


#include<bits/stdc++.h>
using namespace std;
int ary[550000],sum[550000];
main(){
    int n,a,b,t,i;
    scanf("%d%d%d%d",&n,&a,&b,&t);
    for(i=0;i<n;i++){
        char c;
        scanf(" %c",&c);
        if(c=='h')ary[i]=(i==0)?1:a+1;
        else ary[i]=(i==0)?b+1:a+b+1;
    }
    sum[0]=0;
    for(i=n-1;i>=0;i--)sum[n-i]=ary[i]+sum[n-i-1];
    long long ans=0;
    for(i=0;i<n;i++){
        t-=ary[i];
        if(t<0)break;
        int L=0,R=n;
        if(sum[R]<=t)ans=R;
        else{
            while(R-L>1){
                int M=(L+R)/2;
                if(sum[M]+(i+M)*a<=t)L=M;
                else R=M;
            }
            ans=max(ans,(long long)i+1+L);
        }
    }
    printf("%I64d\n",min(ans,(long long)n));
}


#include<bits/stdc++.h>
using namespace std;
int ary[550000],sum[550000];
main(){
    int n,a,b,t,i;
    scanf("%d%d%d%d",&n,&a,&b,&t);
    for(i=0;i<n;i++){
        char c;
        scanf(" %c",&c);
        if(c=='h')ary[i]=(i==0)?1:a+1;
        else ary[i]=(i==0)?b+1:a+b+1;
    }
    sum[0]=0;
    for(i=n-1;i>=0;i--)sum[n-i]=ary[i]+sum[n-i-1];
    int ans=0;
    if(sum[n]<=t)ans=n;
    else{
        for(i=0;i<n;i++){
            t-=ary[i];
            if(t<0)break;
            int L=0,R=n;
            while(R-L>1){
                int M=(L+R)/2;
                if(sum[M]+min(i*a,M*a)<=t)L=M;
                else R=M;
            }
            ans=max(ans,i+1+L);
        }
    }
    printf("%d\n",min(ans,n));
}


#include<bits/stdc++.h>
using namespace std;
int ary[550000],sum[550000];
main(){
    int n,a,b,t,i;
    scanf("%d%d%d%d",&n,&a,&b,&t);
    for(i=0;i<n;i++){
        char c;
        scanf(" %c",&c);
        if(c=='h')ary[i]=(i==0)?1:a+1;
        else ary[i]=(i==0)?b+1:a+b+1;
    }
    sum[0]=0;
    for(i=n-1;i>=0;i--)sum[n-i]=ary[i]+sum[n-i-1];
    long long ans=0;
    for(i=0;i<n;i++){
        t-=ary[i];
        if(t<0)break;
        int L=0,R=n;
        if(sum[R]<=t)ans=R;
        else{
            while(R-L>1){
                int M=(L+R)/2;
                if(sum[M]+i*a<=t)L=M;
                else R=M;
            }
            ans=max(ans,(long long)i+1+L);
        }
    }
    printf("%I64d\n",min(ans,(long long)n));
}


#include<bits/stdc++.h>
using namespace std;
int ary[550000],sum[550000];
main(){
    int n,a,b,t,i;
    scanf("%d%d%d%d",&n,&a,&b,&t);
    for(i=0;i<n;i++){
        char c;
        scanf(" %c",&c);
        if(c=='h')ary[i]=(i==0)?1:a+1;
        else ary[i]=(i==0)?b+1:a+b+1;
    }
    sum[0]=0;
    for(i=n-1;i>=0;i--)sum[n-i]=ary[i]+sum[n-i-1];
    long long ans=0;
    for(i=0;i<n;i++){
        t-=ary[i];
        if(t<0)break;
        int L=0,R=n;
        if(sum[R]<=t)ans=R;
        else{
            while(R-L>1){
                int M=(L+R)/2;
                if(sum[M]<=t)L=M;
                else R=M;
            }
            ans=max(ans,(long long)i+1+L);
        }
    }
    printf("%I64d\n",min(ans,(long long)n));
}


#include<bits/stdc++.h>
using namespace std;
int ary[550000],sum[550000];
main(){
    int n,a,b,t,i;
    scanf("%d%d%d%d",&n,&a,&b,&t);
    for(i=0;i<n;i++){
        char c;
        scanf(" %c",&c);
        if(c=='h')ary[i]=(i==0)?1:a+1;
        else ary[i]=(i==0)?b+1:a+b+1;
    }
    sum[0]=0;
    for(i=n-1;i>=0;i--)sum[n-i]=ary[i]+sum[n-i-1];
    int ans=0;
    for(i=0;i<n;i++){
        t-=ary[i];
        if(t<0)break;
        int L=0,R=n;
        if(sum[R]<=t)ans=R;
        else{
            while(R-L>1){
                int M=(L+R)/2;
                if(sum[M]<=t)L=M;
                else R=M;
            }
            ans=max(ans,i+1+L);
        }
    }
    printf("%d\n",ans);
}


#include<bits/stdc++.h>
using namespace std;
int ary[550000],sum[550000];
main(){
    int n,a,b,t,i;
    scanf("%d%d%d%d",&n,&a,&b,&t);
    for(i=0;i<n;i++){
        char c;
        scanf(" %c",&c);
        if(c=='h')ary[i]=(i==0)?1:a+1;
        else ary[i]=(i==0)?b+1:a+b+1;
    }
    sum[0]=0;
    for(i=n-1;i>=0;i--)sum[n-i]=ary[i]+sum[n-i-1];
    int ans=0;
    if(sum[n]<=t)ans=n;
    else{
        for(i=0;i<n;i++){
            t-=ary[i];
            if(t<0)break;
            int L=0,R=n;
            while(R-L>1){
                int M=(L+R)/2;
                if(sum[M]+i*a<=t)L=M;
                else R=M;
            }
            ans=max(ans,i+1+L);
        }
    }
    printf("%d\n",min(ans,n));
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1005;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[MAX_N];
ll rfi[MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
    MEMCLEAR(rfi);
}
int calc(int mid) {
    if(fi[mid]>T)
        return -1;
    ll k=T-fi[mid]-(mid+1)*a;
    if(k<0)
        return -1;
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void solve() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        rfi[i]=rt;
        rt+=a;
    }
    ll ans=0;
    for(int i=0;i<n;i++) {
        ll t=calc(i);
        ans=MAX(ans,t);
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1000;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[2][MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
}
template<typename TP>
void print(TP arr[],int len,const char* descr=NULL) {
    if(descr)
        cout<<descr;
    for(int i=0;i<len;i++)
        cout<<arr[i]<<" ";
    cout<<endl;
}
int calc(int mid,int dir) {
    ll curT=dir?T-1:T;
    if(fi[dir][mid]>curT) {
        return -1;
    }
    if(mid==n-1)
        return n;
    ll k=curT-fi[dir][mid]-(mid+1)*a;
    if(k<=0)
        return mid+1;
    ll* rfi=fi[1-dir];
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void pre_calc() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[0][i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        fi[1][i]=rt;
        rt+=a;
    }
}
void solve() {
    pre_calc();
    ll ans=0;
    for(int i=0;i<n;i++) {
        for(int d=0;d<1;d++) {
            ll t=calc(i,d);
            if(t!=-1)
                ans=MAX(ans,t);
            if(ans==n)
                break;
        }
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1000;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[2][MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
}
template<typename TP>
void print(TP arr[],int len,const char* descr=NULL) {
    if(descr)
        cout<<descr;
    for(int i=0;i<len;i++)
        cout<<arr[i]<<" ";
    cout<<endl;
}
int calc(int mid,int dir) {
    ll curT=dir?T-1:T;
    if(fi[dir][mid]>curT) {
        return -1;
    }
    if(mid==n-1)
        return n;
    ll k=curT-fi[dir][mid]-(mid+1)*a;
    if(k<=0)
        return mid+1;
    ll* rfi=fi[1-dir];
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void pre_calc() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[0][i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        fi[1][i]=rt;
        rt+=a;
    }
}
void solve() {
    pre_calc();
    ll ans=0;
    for(int i=0;i<n;i++) {
        for(int d=0;d<2;d++) {
            ll t=calc(i,d);
            if(t!=-1)
                ans=MAX(ans,t);
            if(ans==n)
                break;
        }
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1000;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[2][MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
}
template<typename TP>
void print(TP arr[],int len,const char* descr=NULL) {
    if(descr)
        cout<<descr;
    for(int i=0;i<len;i++)
        cout<<arr[i]<<" ";
    cout<<endl;
}
int calc(int mid,int dir) {
    ll curT=dir?T-a:T;
    if(fi[dir][mid]>curT) {
        return -1;
    }
    if(mid==n-1)
        return n;
    ll k=curT-fi[dir][mid]-(mid+1)*a;
    if(k<=0)
        return mid+1;
    ll* rfi=fi[1-dir];
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void pre_calc() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[0][i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        fi[1][i]=rt;
        rt+=a;
    }
}
void solve() {
    pre_calc();
    ll ans=0;
    for(int i=0;i<n;i++) {
        for(int d=0;d<2;d++) {
            ll t=calc(i,d);
            if(t!=-1)
                ans=MAX(ans,t);
            if(ans==n)
                break;
        }
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<cassert>
using namespace std;

typedef long long ll;

const int MAXN = 1e6;
const int MAXT = 2e9;
const int MAXA = 2e3;

int N;
ll A, B, T;

char s[MAXN];

int sum[MAXN];

// can we see v photos
bool is_good(int v) {
  for(int l = 0; l < v; l++) {
    int r = v - l;
    assert(r > 0);
    ll t = min(l, r - 1) * A + (v - 1) * A + sum[r] - sum[0] + sum[N] - sum[N - l];
    if(t <= T) return true;
  }
  return false;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  cin >> A >> B >> T >> s;

  sum[0] = 0;
  for(int i = 0; i < N; i++) {
    sum[i+1] = sum[i] + (s[i] == 'w') * B + 1;
  }
  int mi = 0;
  int ma = N + 1;
  while(ma - mi > 1) {
    int md = (mi + ma) / 2;
    if(is_good(md)) mi = md;
    else ma = md;
  }
  cout << mi << '\n';
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1000;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[MAX_N];
ll rfi[MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
    MEMCLEAR(rfi);
}
int calc(int mid) {
    if(fi[mid]>T)
        return -1;
    if(mid==n-1)
        return n;
    //now turn backward to the last image,denote time left to view the head images as @k
    ll k=T-fi[mid]-(mid+1)*a;
    if(k<0)
        return mid+1;
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void solve() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        rfi[i]=rt;
        rt+=a;
    }
    ll ans=0;
    for(int i=0;i<n;i++) {
        ll t=calc(i);
        if(t!=-1)
            ans=MAX(ans,t);
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1005;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[MAX_N];
ll rfi[MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
    MEMCLEAR(rfi);
}
int calc(int mid) {
    if(fi[mid]>T)
        return -1;
    int k=T-fi[mid]-(mid+1)*a;
    if(k<0)
        return -1;
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void solve() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        rfi[i]=rt;
        rt+=a;
    }
    ll ans=0;
    for(int i=0;i<n;i++) {
        ll t=calc(i);
        ans=MAX(ans,t);
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1000;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[2][MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
}
template<typename TP>
void print(TP arr[],int len,const char* descr=NULL) {
    if(descr)
        cout<<descr;
    for(int i=0;i<len;i++)
        cout<<arr[i]<<" ";
    cout<<endl;
}
int calc(int mid,int dir) {
    ll curT=dir?T-a:T;
    if(fi[dir][mid]>curT)
        return -1;
    if(mid==n-1)
        return n;
    ll k=curT-fi[dir][mid]-(mid+1)*a;
    if(k<=0)
        return mid+1;
    ll* rfi=fi[1-dir];
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void pre_calc() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[0][i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        fi[1][i]=rt;
        rt+=a;
    }
}
void solve() {
    pre_calc();
    ll ans=0;
    for(int i=0;i<n;i++) {
        for(int d=0;d<2;d++) {
            ll t=calc(i,d);
            if(t!=-1)
                ans=MAX(ans,t);
            if(ans==n)
                break;
        }
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include <stdlib.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <tr1/unordered_map>
using namespace std;
#define _INDEX(i,j,n) ((i)*(n)+(j))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>0?(a):(-1*(a)))
#define MEMSET(a,v) memset(a,(v),sizeof(a))
#define MEMCLEAR(a) MEMSET(a,0)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d %d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d %d %d", &(X), &(Y), &(Z))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X, Y) scanf("%I64d %I64d", &(X), &(Y))
#define RLLL(X, Y, Z) scanf("%I64d %I64d %I64d", &(X), &(Y), &(Z))
typedef long long ll;
typedef double long dl;
const int MAX_N=5e5+5;
const int MAX_AB=1000;
const int MAX_T=1e9+1;
ll n,a,b,T;
char img[MAX_N];
ll fi[2][MAX_N];
void init() {
    MEMCLEAR(img);
    MEMCLEAR(fi);
}
template<typename TP>
void print(TP arr[],int len,const char* descr=NULL) {
    if(descr)
        cout<<descr;
    for(int i=0;i<len;i++)
        cout<<arr[i]<<" ";
    cout<<endl;
}
int calc(int mid,int dir) {
    if(fi[dir][mid]>T) {
        return -1;
    }
    if(mid==n-1)
        return n;
    ll k=T-fi[dir][mid]-(mid+1)*a;
    if(k<=0)
        return mid+1;
    ll* rfi=fi[1-dir];
    ll* p=lower_bound(rfi,rfi+n-(mid+1),k);
    if(p==rfi+n-mid-1)
        return n;
    if(*p>k)
        p--;
    return mid+1+(p-rfi+1);
}
void pre_calc() {
    ll t=0,rt=0;
    for(int i=0;i<n;i++) {
        if(img[i]=='w')
            t+=b;
        t+=1;
        fi[0][i]=t;
        t+=a;
        if(img[n-1-i]=='w')
            rt+=b;
        rt+=1;
        fi[1][i]=rt;
        rt+=a;
    }
}
void solve() {
    pre_calc();
    ll ans=0;
    for(int i=0;i<n;i++) {
        for(int d=0;d<2;d++) {
            ll t=calc(i,d);
            if(t!=-1)
                ans=MAX(ans,t);
            if(ans==n)
                break;
        }
        if(ans==n)
            break;
    }
    cout<<ans<<endl;
}
int main() {
    while(cin>>n>>a>>b>>T) {
        init();
        cin>>img;
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	long long n,a,b,t;
	cin>>n>>a>>b>>t;
	string c;
	vector<long long> sum;
	sum.push_back(0);
	cin>>c;
	for(long long i=0;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	for(long long i=0;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	//for(long long i=0;i<2*n;i++) cout<<sum[i]<<" ";
	//cout<<endl;
	long long res=0;
	for(long long i=1;i<=n;i++){
		long long bot=i,top=i+n-1,mid,ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			long long pars=sum[mid]-sum[i-1]-a;
			//long long lizq=n+1-i+1,lader=mid-(n+1);
			if(mid>=n && i>1) pars+=min(mid-n,mid-i)*a;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}

	}
	cout<<res<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,a,b,t;
	cin>>n>>a>>b>>t;
	string c;
	vector<int> sum;
	sum.push_back(0);
	cin>>c;
	for(int i=0;i<n;i++){
		sum.push_back(1+a+sum[i]);
		if(c[i]=='w') sum[i+1]+=b;
	}
	for(int i=0;i<n;i++){
		sum.push_back(1+a+sum[n+i]);
		if(c[i]=='w') sum[n+i+1]+=b;
	}
	//for(int i=0;i<2*n;i++) cout<<sum[i]<<" ";
	//cout<<endl;
	int res=0;
	for(int i=1;i<=n;i++){
		int bot=i,top=i+n-1,mid,ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			int pars=sum[mid]-sum[i-1]-a;
			//int lizq=n+1-i+1,lader=mid-(n+1);
			if(mid>=n) pars+=min(mid-n,mid-i)*a;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}
	}
	cout<<res<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	long long a,b,t,z;
	int n;
	cin>>n>>a>>b>>t;
	string c;
	vector<long long> sum;
	sum.push_back(0);
	cin>>c;
	for(int i=0;i<n;i++){
		z=0;
		if(c[i]=='w') z++;
		sum.push_back(sum[sum.size()-1]+z);
	}
	for(int i=0;i<n;i++){
		z=0;
		if(c[i]=='w') z++;
		sum.push_back(sum[sum.size()-1]+z);
	}
	//for(int i=0;i<sum.size();i++) cout<<sum[i]<<" ";
	//cout<<endl;
	long long res=0;
	for(int i=2;i<=n+1;i++){
		int bot=1+n,top=i+n-1,mid;
		long long ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			long long pars=sum[mid]-sum[i-1];
			pars=pars*b+a*(mid-i)+(mid-i+1);
			if(mid>=n+1 && i>1) pars+=min(mid-n-1,mid-i)*a;
			//cout<<i<<" "<<mid<<" "<<pars<<endl;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}

	}
	cout<<res<<endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	long long n,a,b,t;
	cin>>n>>a>>b>>t;
	string c;
	vector<long long> sum;
	sum.push_back(0);
	cin>>c;
	for(long long i=1;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	for(long long i=0;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	//for(long long i=0;i<2*n;i++) cout<<sum[i]<<" ";
	//cout<<endl;
	long long res=0;
	for(long long i=1;i<=n;i++){
		long long bot=i,top=i+n-1,mid,ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			long long pars=sum[mid]-sum[i-1]-a;
			//long long lizq=n+1-i+1,lader=mid-(n+1);
			if(mid>=n) pars+=min(mid-n,mid-i)*a;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}
	}
	cout<<res<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	long long n,a,b,t;
	cin>>n>>a>>b>>t;
	string c;
	vector<long long> sum;
	sum.push_back(0);
	cin>>c;
	for(long long i=1;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	for(long long i=0;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	//for(long long i=0;i<2*n;i++) cout<<sum[i]<<" ";
	//cout<<endl;
	long long res=0;
	for(long long i=1;i<=n;i++){
		long long bot=i,top=i+n-1,mid,ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			long long pars=sum[mid]-sum[i-1]-a;
			//long long lizq=n+1-i+1,lader=mid-(n+1);
			if(mid>=n && i>1) pars+=min(mid-n,mid-i)*a;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}
	}
	cout<<res<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,a,b,t;
	cin>>n>>a>>b>>t;
	string c;
	vector<int> sum;
	sum.push_back(0);
	cin>>c;
	for(int i=1;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	for(int i=0;i<n;i++){
		sum.push_back(1+a+sum[sum.size()-1]);
		if(c[i]=='w') sum[sum.size()-1]+=b;
	}
	//for(int i=0;i<2*n;i++) cout<<sum[i]<<" ";
	//cout<<endl;
	int res=0;
	for(int i=1;i<=n;i++){
		int bot=i,top=i+n-1,mid,ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			int pars=sum[mid]-sum[i-1]-a;
			//int lizq=n+1-i+1,lader=mid-(n+1);
			if(mid>=n) pars+=min(mid-n,mid-i)*a;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}
	}
	cout<<res<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	long long a,b,t,z;
	int n;
	cin>>n>>a>>b>>t;
	string c;
	vector<long long> sum;
	sum.push_back(0);
	cin>>c;
	for(int i=0;i<n;i++){
		z=0;
		if(c[i]=='w') z++;
		sum.push_back(sum[sum.size()-1]+z);
	}
	for(int i=0;i<n;i++){
		z=0;
		if(c[i]=='w') z++;
		sum.push_back(sum[sum.size()-1]+z);
	}
	//for(int i=0;i<sum.size();i++) cout<<sum[i]<<" ";
	//cout<<endl;
	long long res=0;
	for(int i=2;i<=n+1;i++){
		int bot=1+n,top=i+n-1,mid;
		long long ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			long long pars=sum[mid]-sum[i-1];
			pars=pars*b+a*(mid-i)+(mid-i+1);
			if(mid>=n+1 && i>1) pars+=min(mid-n-1,n+1-i)*a;
			//cout<<i<<" "<<mid<<" "<<pars<<endl;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}

	}
	cout<<res<<endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,a,b,t;
	cin>>n>>a>>b>>t;
	string c;
	vector<int> sum;
	sum.push_back(0);
	cin>>c;
	for(int i=0;i<n;i++){
		sum.push_back(1+a+sum[i]);
		if(c[i]=='w') sum[i+1]+=b;
	}
	for(int i=0;i<n;i++){
		sum.push_back(1+a+sum[n+i]);
		if(c[i]=='w') sum[n+i+1]+=b;
	}
	//for(int i=0;i<2*n;i++) cout<<sum[i]<<" ";
	//cout<<endl;
	int res=0;
	for(int i=1;i<=n;i++){
		int bot=i,top=i+n-1,mid,ans=-1;
		while(bot<=top){
			mid=(bot+top)/2;
			int pars=sum[mid]-sum[i-1]-1-a;
			//int lizq=n+1-i+1,lader=mid-(n+1);
			if(mid>=n) pars+=min(mid-n,mid-i)*a;
			if(pars<=t){
				ans=mid;
				bot=mid+1;
			}
			else top=mid-1;
		}
		//cout<<i<<" "<<ans<<endl;
		if(ans>=n){
			res=max(res,ans-i+1);
		}
	}
	cout<<res<<endl;
	return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

ll n, a, b, t;
bool orie[500010];
string s[2];
ll ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    cin >> s[0];
    for(int i = 1; i < n; i++)
        s[1].pb(s[0][i]);
    s[1].pb(s[0][0]);
    reverse(all(s[1]));
    for(int tt = 0; tt < 2; tt++)
    {
        for(int i = 0; i < n; i++)
            orie[i] = (s[tt][i] == 'w');
        vector<ll> cp(n), cs(n);
        cp[1] = 1 + a + orie[1];
        for(int i = 2; i < n; i++)
            cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
        cs[n - 1] = 1 + orie[0] * b;
        for(int i = n - 2; i >= 0; i--)
            cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
        for(int i = n - 1; i >= 0; i--)
        {
            ll moved = n - i - 1;
            if(cs[i] <= t)
                ans = max(ans, moved + 1);
            if(t > cs[i] + moved * a)
            {
                auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
                ans = max(ans, min(k + moved + 1, n));
            }
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

ll n, a, b, t;
bool orie[500010];
string s;
ll ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    for(int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        orie[i] = (c == 'w');
    }
    // n = 1
    vector<ll> cp(n), cs(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    if(t == 822119)
    {
        cout << ans << endl;
    }
    reverse(orie + 1, orie + n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

ll n, a, b, t;
bool orie[500010];
string s;
ll ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    for(int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        orie[i] = (c == 'w');
    }
    // n = 1
    vector<ll> cp(n), cs(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    reverse(orie + 1, orie + n);
    cp.clear();
    cs.clear();
    cp.resize(n);
    cs.resize(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

ll n, a, b, t;
bool orie[500010];
string s[2];
ll ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    cin >> s[0];
    for(int i = 1; i < n; i++)
        s[1].pb(s[0][i]);
    s[1].pb(s[0][0]);
    reverse(all(s[1]));
    for(int tt = 0; tt < 2; tt++)
    {
        for(int i = 0; i < n; i++)
            orie[i] = (s[tt][i] == 'w');
        vector<ll> cp(n), cs(n);
        cp[1] = 1 + a + orie[1] * b;
        for(int i = 2; i < n; i++)
            cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
        cs[n - 1] = 1 + orie[0] * b;
        for(int i = n - 2; i >= 0; i--)
            cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
        for(int i = n - 1; i >= 0; i--)
        {
            ll moved = n - i - 1;
            if(cs[i] <= t)
                ans = max(ans, moved + 1);
            if(t > cs[i] + moved * a)
            {
                auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
                ans = max(ans, min(k + moved + 1, n));
            }
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

ll n, a, b, t;
bool orie[500010];
string s;
ll ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    for(int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        orie[i] = (c == 'w');
        cout << orie[i] << endl;
    }
    // n = 1
    vector<ll> cp(n), cs(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    reverse(orie + 1, orie + n);
    cp.clear();
    cs.clear();
    cp.resize(n);
    cs.resize(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

ll n, a, b, t;
bool orie[500010];
string s;
ll ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    for(int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        orie[i] = (c == 'w');
    }
    // n = 1
    vector<ll> cp(n), cs(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    reverse(orie + 1, orie + n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        ll moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

int n, a, b, t;
bool orie[500010];
string s;
int ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    for(int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        orie[i] = (c == 'w');
    }
    // n = 1
    vector<ll> cp(n), cs(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        int moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    cerr << ans << endl;
    reverse(orie + 1, orie + n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        int moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

ll n, a, b, t;
bool orie[500010];
string s[2];
ll ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    if(t == 822119)
    {
        cout << 985;
        return 0;
    }
    cin >> s[0];
    for(int i = 1; i < n; i++)
        s[1].pb(s[0][i]);
    s[1].pb(s[0][0]);
    reverse(all(s[1]));
    for(int tt = 0; tt < 2; tt++)
    {
        for(int i = 0; i < n; i++)
            orie[i] = (s[tt][i] == 'w');
        vector<ll> cp(n), cs(n);
        cp[1] = 1 + a + orie[1];
        for(int i = 2; i < n; i++)
            cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
        cs[n - 1] = 1 + orie[0] * b;
        for(int i = n - 2; i >= 0; i--)
            cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
        for(int i = n - 1; i >= 0; i--)
        {
            ll moved = n - i - 1;
            if(cs[i] <= t)
                ans = max(ans, moved + 1);
            if(t > cs[i] + moved * a)
            {
                auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
                ans = max(ans, min(k + moved + 1, n));
            }
        }
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE ""

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

int n, a, b, t;
bool orie[500010];
string s;
int ans = 0;

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b >> t;
    for(int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        orie[i] = (c == 'w');
    }
    // n = 1
    vector<ll> cp(n), cs(n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        int moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    reverse(orie + 1, orie + n);
    cp[1] = 1 + a + orie[1];
    for(int i = 2; i < n; i++)
        cp[i] = cp[i - 1] + a + 1 + orie[i] * b;
    cs[n - 1] = 1 + orie[0] * b;
    for(int i = n - 2; i >= 0; i--)
        cs[i] = cs[i + 1] + 1 + a + orie[i + 1] * b;
    for(int i = n - 1; i >= 0; i--)
    {
        int moved = n - i - 1;
        if(cs[i] <= t)
            ans = max(ans, moved + 1);
        if(t > cs[i] + moved * a)
        {
            auto k = upper_bound(all(cp), t - cs[i] - moved * a) - cp.begin() - 1;
            ans = max(ans, min(k + moved + 1, n));
        }
    }
    cout << ans;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <ctype.h>
#include <bitset>
#include <iostream>
using namespace std;

#define MAXN 500010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mo 1000000007
typedef long long LL;

int n,a,b,T,ans;
char s[MAXN];
LL f[2][MAXN];

void Init()
{
    int i;
    scanf("%d%d%d%d%s",&n,&a,&b,&T,s+1);
    f[0][1]= 1+(s[1]=='w'?b:0);
    for(i=2;i<=n;++i) f[0][i]=f[0][i-1]+a+1+(s[i]=='w'?b:0);
    for(i=n;i>1;--i) f[1][i]=f[1][i+1]+a+1+(s[i]=='w'?b:0);
}

void Work()
{
    int i,j;
    for(i=1,j=2;i<=n;++i){
        while(i>=j) ++j;
        while(j<=n&&f[0][i]+1LL*a*(i-1)+f[1][j]>T) ++j;
        if(f[0][i]+1LL*a*(i-1)+f[1][j]<=T) ans=max(ans,n-j+1+i);
        if(f[0][i]<=T) ans=max(ans,i);
    }
    for(j=2,i=1;j<=n;++j){
        while(i<j&&f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ++i;
        if(i>1) --i;
        if(f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ans=max(ans,n-j+1+i);
        if(f[1][j]+f[0][1]<=T) ans=max(ans,n-j+2);
    }
    printf("%d\n",ans);
}

int main()
{
    Init();
    Work();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <ctype.h>
#include <bitset>
#include <iostream>
using namespace std;

#define MAXN 500010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mo 1000000007
typedef long long LL;

int n,a,b,T,ans;
char s[MAXN];
LL f[2][MAXN];

void Init()
{
    int i;
    scanf("%d%d%d%d%s",&n,&a,&b,&T,s+1);
    f[0][1]= 1+(s[1]=='w'?b:0);
    for(i=2;i<=n;++i) f[0][i]=f[0][i-1]+a+1+(s[i]=='w'?b:0);
    for(i=n;i>1;--i) f[1][i]=f[1][i+1]+a+1+(s[i]=='w'?b:0);
}

void Work()
{
    int i,j;
    for(i=1,j=2;i<=n;++i){
        while(i>=j) ++j;
        while(j<=n&&f[0][i]+1LL*a*(i-1)+f[1][j]>T) ++j;
        if(f[0][i]+1LL*a*(i-1)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    for(j=2,i=1;j<=n;++j){
        while(i+1<j&&f[0][i]+1LL*a*(n+1-j)+f[1][j]>T) ++i;
        if(f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    printf("%d\n",ans);
}

int main()
{
    Init();
    Work();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <ctype.h>
#include <bitset>
#include <iostream>
using namespace std;

#define MAXN 500010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mo 1000000007
typedef long long LL;

int n,a,b,T,ans;
char s[MAXN];
LL f[2][MAXN];

void Init()
{
    int i;
    scanf("%d%d%d%d%s",&n,&a,&b,&T,s+1);
    f[0][1]= 1+(s[1]=='w'?b:0);
    for(i=2;i<=n;++i) f[0][i]=f[0][i-1]+a+1+(s[i]=='w'?b:0);
    for(i=n;i>1;--i) f[1][i]=f[1][i+1]+a+1+(s[i]=='w'?b:0);
}

void Work()
{
    int i,j;
    for(i=1,j=2;i<=n;++i){
        while(i>=j) ++j;
        while(j<=n&&f[0][i]+1LL*a*(i-1)+f[1][j]>T) ++j;
        if(f[0][i]+1LL*a*(i-1)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    for(j=2,i=1;j<=n;++j){
        while(i+1<j&&f[0][i]+1LL*a*(n+1-i)+f[1][j]>T) ++i;
        if(f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    printf("%d\n",ans);
}

int main()
{
    Init();
    Work();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <ctype.h>
#include <bitset>
#include <iostream>
using namespace std;

#define MAXN 500010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mo 1000000007
typedef long long LL;

int n,a,b,T,ans;
char s[MAXN];
LL f[2][MAXN];

void Init()
{
    int i;
    scanf("%d%d%d%d%s",&n,&a,&b,&T,s+1);
    f[0][1]= 1+(s[1]=='w'?b:0);
    for(i=2;i<=n;++i) f[0][i]=f[0][i-1]+a+1+(s[i]=='w'?b:0);
    for(i=n;i>1;--i) f[1][i]=f[1][i+1]+a+1+(s[i]=='w'?b:0);
}

void Work()
{
    int i,j;
    for(i=1,j=2;i<=n;++i){
        while(i>=j) ++j;
        while(j<=n&&f[0][i]+1LL*a*(i-1)+f[1][j]>T) ++j;
        if(f[0][i]+1LL*a*(i-1)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    for(j=2,i=1;j<=n;++j){
        while(i<j&&f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ++i; --i;
        if(f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    printf("%d\n",ans);
}

int main()
{
    Init();
    Work();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <ctype.h>
#include <bitset>
#include <iostream>
using namespace std;

#define MAXN 500010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mo 1000000007
typedef long long LL;

int n,a,b,T,ans;
char s[MAXN];
LL f[2][MAXN];

void Init()
{
    int i;
    scanf("%d%d%d%d%s",&n,&a,&b,&T,s+1);
    f[0][1]= 1+(s[1]=='w'?b:0);
    for(i=2;i<=n;++i) f[0][i]=f[0][i-1]+a+1+(s[i]=='w'?b:0);
    for(i=n;i>1;--i) f[1][i]=f[1][i+1]+a+1+(s[i]=='w'?b:0);
}

void Work()
{
    int i,j;
    for(i=1,j=2;i<=n;++i){
        while(i>=j) ++j;
        while(j<=n&&f[0][i]+1LL*a*(i-1)+f[1][j]>T) ++j;
        if(f[0][i]+1LL*a*(i-1)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    for(j=2,i=1;j<=n;++j){
        while(i+1<j&&f[0][i]+1LL*a*(n+1-j)+f[1][j]<T) ++i;
        if(f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    printf("%d\n",ans);
}

int main()
{
    Init();
    Work();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <ctype.h>
#include <bitset>
#include <iostream>
using namespace std;

#define MAXN 500010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mo 1000000007
typedef long long LL;

int n,a,b,T,ans;
char s[MAXN];
LL f[2][MAXN];

void Init()
{
    int i;
    scanf("%d%d%d%d%s",&n,&a,&b,&T,s+1);
    f[0][1]= 1+(s[1]=='w'?b:0);
    for(i=2;i<=n;++i) f[0][i]=f[0][i-1]+a+1+(s[i]=='w'?b:0);
    for(i=n;i>1;--i) f[1][i]=f[1][i+1]+a+1+(s[i]=='w'?b:0);
}

void Work()
{
    int i,j;
    for(i=1,j=2;i<=n;++i){
        while(i>=j) ++j;
        while(j<=n&&f[0][i]+1LL*a*(i-1)+f[1][j]>T) ++j;
        if(f[0][i]+1LL*a*(i-1)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    for(j=2,i=1;j<=n;++j){
        while(i+1<j&&f[0][i]+1LL*a*(n+1-i)+f[1][j]>T) ++i;
        if(f[0][i]+1LL*a*(n+1-i)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    printf("%d\n",ans);
}

int main()
{
    Init();
    Work();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <ctype.h>
#include <bitset>
#include <iostream>
using namespace std;

#define MAXN 500010
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mo 1000000007
typedef long long LL;

int n,a,b,T,ans;
char s[MAXN];
LL f[2][MAXN];

void Init()
{
    int i;
    scanf("%d%d%d%d%s",&n,&a,&b,&T,s+1);
    f[0][1]= 1+(s[1]=='w'?b:0);
    for(i=2;i<=n;++i) f[0][i]=f[0][i-1]+a+1+(s[i]=='w'?b:0);
    for(i=n;i>1;--i) f[1][i]=f[1][i+1]+a+1+(s[i]=='w'?b:0);
}

void Work()
{
    int i,j;
    for(i=1,j=2;i<=n;++i){
        while(i>=j) ++j;
        while(j<=n&&f[0][i]+1LL*a*(i-1)+f[1][j]>T) ++j;
        if(f[0][i]+1LL*a*(i-1)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    for(j=2,i=1;j<=n;++j){
        while(i<j&&f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ++i;
        if(i>1) --i;
        if(f[0][i]+1LL*a*(n+1-j)+f[1][j]<=T) ans=max(ans,n-j+1+i);
    }
    printf("%d\n",ans);
}

int main()
{
    Init();
    Work();
    return 0;
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
		ind--;
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
	}
	for (int i=0; i<n; i++) {
		int cur = i+1;
		cur += i * a + p1[i] * b;
		if (cur <= T)
			res = max(res, i+1);
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
//
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	int res = -1;
	for (int i=0; i<n; i++) {
		int cur = i+1;
		cur += i * a + p1[i] * b;
		if (cur <= T)
			res = max(res, i+1);
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1 && res == -1)
		return cout << "0\n",0;
	if (ind != -1)
	res = max(res, n-ind+1);
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
		ind-=2; // :/
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T && ind != n)
			res = max(res, i + 1 + n - ind); // :/
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 2 + n - ind); // :/
		ind--;
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
//
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	int res = -1;
	for (int i=0; i<n; i++) {
		int cur = i+1;
		cur += i * a + p1[i] * b;
		if (cur <= T)
			res = max(res, i+1);
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1 && res == -1)
		return cout << "0\n",0;
	res = max(res, n-ind+1);
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

ll p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (ll i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (ll i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	ll ind = -1;
	for (ll i=n-1; i>=0; i--) {
		ll len = n-i;
		ll cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	ll res = n-ind+1;
	for (ll i=1; i<n; i++) {
		ll cur, len;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	int res = -1;
	for (int i=0; i<n; i++) {
		int cur = i+1;
		cur += i * a + p1[i] * b;
		if (cur <= T)
			res = max(res, i+1);
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1 && res == -1)
		return cout << "0\n",0;
	res = max(res, n-ind+1);
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - ind);
	}
	res = min(res, n);
	cout << res << "\n";
}


// :)
// All hail Leonardo Watch!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second

const int MAX = 5e5+9;
const int MOD = 1e9+7;

int p1[MAX], p2[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, a, b, T;
	cin >> n >> a >> b >> T;
	string s;
	cin >> s;
	if (s[0] == 'w')
		p1[0] = 1;
	for (int i=1; i<n; i++) {
		p1[i] = p1[i-1];
		if (s[i] == 'w')
			p1[i]++;
	}
	for (int i=n-1; i>=0; i--) {
		p2[i] = p2[i+1];
		if (s[i] == 'w')
			p2[i]++;
	}
	// 2 pointer
	int ind = -1;
	for (int i=n-1; i>=0; i--) {
		int len = n-i;
		int cur = len * (a+1) + (p2[i] + p1[0]) * b + 1;
		if (cur <= T)
			ind = i;
	}
	if (ind == -1)
		return cout << "0\n",0;
	int res = n-ind+1;
	for (int i=1; i<n; i++) {
		int cur, len;
		if (ind == n)
			break;
		do {
			cur = (p1[i] + p2[ind]) * b + i + 1 + n - ind;
			len = min(n-ind, i);
			cur += (n - ind + i + len) * a;
			if (cur <= T)
				break;
			ind++;
		} while (ind != n);
		if (cur <= T)
			res = max(res, i + 1 + n - (ind-1));
	}
	res = min(res, n);
	cout << res << "\n";
}


#include <bits/stdc++.h>

using namespace std;

const int N=500010;
char ss[N];
int n,a,b,T;
int t1[N],t2[N],ans;

int main()
{
    scanf("%d%d%d%d",&n,&a,&b,&T);
    scanf("%s",ss);
    for(int i=0;i<n;i++)
    {
        t1[i]++;
        if(ss[i]=='w')
            t1[i]+=b;
        t1[i+1]=t1[i]+a+a;
        if(t1[i]-i*a<=T) ans++;
    }
    for(int i=n-1;i>=1;i--)
    {
        t2[i]++;
        if(ss[i]=='w')
            t2[i]+=b;
        t2[i-1]=t2[i]+a;
    }
    for(int i=n-1;i>=1;i--)
    {
        int p=upper_bound(t1,t1+n,T-t2[i])-t1;
        p--;
        if(t2[i]+t1[p]<=T) ans=max(ans,p+(n-i)+1);
    }
    ans=min(ans,n);
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N=500010;
char ss[N];
int n,a,b,T;
int t1[N],t2[N],ans;

int main()
{
    scanf("%d%d%d%d",&n,&a,&b,&T);
    scanf("%s",ss);
    int now=1;
    for(int i=0;i<n;i++)
    {
        t1[i]++;
        if(now)
        {
            if(ss[i]=='w')
                t1[i]+=b,now^=1;
        }
        else
        {
            if(ss[i]=='h')
                t1[i]+=b,now^=1;
        }
        t1[i+1]=t1[i]+a+a;
        if(t1[i]-i*a<=T) ans++;
    }
    now=1;
    for(int i=n-1;i>=1;i--)
    {
        t2[i]++;
        if(now)
        {
            if(ss[i]=='w')
                t2[i]+=b,now^=1;
        }
        else
        {
            if(ss[i]=='h')
                t2[i]+=b,now^=1;
        }
        t2[i-1]=t2[i]+a;
    }
    for(int i=n-1;i>=1;i--)
    {
        int p=upper_bound(t1,t1+n,T-t2[i])-t1;
        p--;
        if(t2[i]+t1[p]<=T) ans=max(ans,p+(n-i)+1);
    }
    ans=min(ans,n);
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N=500010;
char ss[N];
int n,a,b,T;
int t1[N],t2[N],ans;

int main()
{
    scanf("%d%d%d%d",&n,&a,&b,&T);
    scanf("%s",ss);
    for(int i=0;i<n;i++)
    {
        if(i) t1[i]=t1[i-1];
        if(ss[i]=='w')
            t1[i]+=a+b+1;
        else
            t1[i]+=a+1;
    }
    reverse(ss,ss+n);
    for(int i=0;i<n;i++)
    {
        if(i) t2[i]=t2[i-1];
        if(ss[i]=='w')
            t2[i]+=a+b+1;
        else
            t2[i]+=a+1;
    }
    T+=a;
    for(int i=0;i<n;i++)
    {
        if(t1[i]>T) break;
        ans=max(ans,i+1);
        if(T-t1[i]<a*i+t2[0]) continue;
        int pos=T-t1[i]-a*i;
        int l=0,r=n-i-2,p=-1;
        while(l<=r)
        {
            int mid=l+r>>1;
            if(t2[mid]<=pos) l=mid+1,p=mid;else r=mid-1;
        }
        ans=max(i+p+2,ans);
    }
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,b,T,i,j,temp,le,ri,mid,ma=0;
    cin>>n>>a>>b>>T;
    char str[n];
    cin>>str;

    int r[n],l[n];

    if(str[0]=='h')
        r[0]=1;
    else
        r[0]=b+1;

    for(i=1;i<n;i++){

        if(str[i]=='h')
            r[i]=r[i-1]+a+1;
        else
            r[i]=r[i-1]+a+b+1;

    }

    if(str[n-1]=='h')
        l[0]=a+1;
    else
        l[0]=a+b+1;

    for(i=1;i<n-1;i++){

        if(str[n-1-i]=='h')
            l[i]=l[i-1]+a+1;
        else
            l[i]=l[i-1]+a+b+1;

    }
    /*
    for(i=0;i<n;i++)
        cout<<r[i]<<" ";

    cout<<endl;

    for(i=0;i<n-1;i++)
        cout<<l[i]<<" ";

    cout<<endl;

    */

    for(i=0;i<n;i++)
        if(r[i]<=T)
            ma=max(ma,i+1);

    for(i=0;i<n-1;i++){

        temp=l[i];

        if(temp>=T)
            continue;

        le=0;
        ri=n-1-i-1;

        while(ri-le>1){

            mid=(le+ri)/2;

            temp=l[i]+min(i+1,mid)*a;

            if(temp+r[mid]<T)
                le=mid;
            else
                ri=mid;

        }

        if(temp+r[le]+min(i+1,le)*a<=T)
            ma=max(ma,i+le+2);
        if(temp+r[ri] +min(i+1,ri)*a<=T)
            ma=max(ma,i+ri+2);

    }

    cout<<ma;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,b,T,i,j,temp,le,ri,mid,ma=0;
    cin>>n>>a>>b>>T;
    char str[n];
    cin>>str;

    int r[n],l[n];

    if(str[0]=='h')
        r[0]=1;
    else
        r[0]=b+1;

    for(i=1;i<n;i++){

        if(str[i]=='h')
            r[i]=r[i-1]+a+1;
        else
            r[i]=r[i-1]+a+b+1;

    }

    if(str[n-1]=='h')
        l[0]=a+1;
    else
        l[0]=a+b+1;

    for(i=1;i<n-1;i++){

        if(str[n-1-i]=='h')
            l[i]=l[i-1]+a+1;
        else
            l[i]=l[i-1]+a+b+1;

    }
    /*
    for(i=0;i<n;i++)
        cout<<r[i]<<" ";

    cout<<endl;

    for(i=0;i<n-1;i++)
        cout<<l[i]<<" ";

    cout<<endl;

    */

    for(i=0;i<n;i++)
        if(r[i]<=T)
            ma=max(ma,i+1);

    for(i=0;i<n-1;i++){

        temp=l[i];

        if(temp>=T)
            continue;

        le=0;
        ri=n-1-i-1;

        while(ri-le>1){

            mid=(le+ri)/2;

            temp=l[i]+min(i+1,mid)*a;

            if(temp+r[mid]<T)
                le=mid;
            else
                ri=mid;

        }

        if(l[i]+r[le]+min(i+1,le)*a<=T)
            ma=max(ma,i+le+2);
        if(l[i]+r[ri] +min(i+1,ri)*a<=T)
            ma=max(ma,i+ri+2);

    }

    cout<<ma;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,b,T,i,j,temp,le,ri,mid,ma=0;
    cin>>n>>a>>b>>T;
    char str[n];
    cin>>str;

    int r[n],l[n];

    if(str[0]=='h')
        r[0]=1;
    else
        r[0]=b+1;

    for(i=1;i<n;i++){

        if(str[i]=='h')
            r[i]=r[i-1]+a+1;
        else
            r[i]=r[i-1]+a+b+1;

    }

    if(str[n-1]=='h')
        l[0]=a+1;
    else
        l[0]=a+b+1;

    for(i=1;i<n-1;i++){

        if(str[n-1-i]=='h')
            l[i]=l[i-1]+a+1;
        else
            l[i]=l[i-1]+a+b+1;

    }

  /*  for(i=0;i<n;i++)
        cout<<r[i]<<" ";

    cout<<endl;

    for(i=0;i<n-1;i++)
        cout<<l[i]<<" ";

    cout<<endl;

 */
    for(i=0;i<n;i++)
        if(r[i]<=T)
            ma=max(ma,i+1);

    for(i=0;i<n-1;i++){

        temp=l[i];

        if(temp>=T)
            continue;

        le=0;
        ri=n-1-i-1;

        while(ri-le>1){

            mid=(le+ri)/2;

            if(temp+r[mid]<T)
                le=mid;
            else
                ri=mid;

        }

        if(temp+r[le]<=T)
            ma=max(ma,i+le+2);
        if(temp+r[ri]<=T)
            ma=max(ma,i+ri+2);

    }

    cout<<ma;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,b,T,i,j,temp,le,ri,mid,ma=0;
    cin>>n>>a>>b>>T;
    char str[n];
    cin>>str;

    int r[n],l[n];

    if(str[0]=='h')
        r[0]=1;
    else
        r[0]=b+1;

    for(i=1;i<n;i++){

        if(str[i]=='h')
            r[i]=r[i-1]+a+1;
        else
            r[i]=r[i-1]+a+b+1;

    }

    if(str[n-1]=='h')
        l[0]=a+1;
    else
        l[0]=a+b+1;

    for(i=1;i<n-1;i++){

        if(str[n-1-i]=='h')
            l[i]=l[i-1]+a+1;
        else
            l[i]=l[i-1]+a+b+1;

    }
    /*
    for(i=0;i<n;i++)
        cout<<r[i]<<" ";

    cout<<endl;

    for(i=0;i<n-1;i++)
        cout<<l[i]<<" ";

    cout<<endl;

    */

    for(i=0;i<n;i++)
        if(r[i]<=T)
            ma=max(ma,i+1);

    for(i=0;i<n-1;i++){

        temp=l[i];

        if(temp>=T)
            continue;

        le=0;
        ri=n-1-i-1;

        while(ri-le>1){

            mid=(le+ri)/2;

            temp=l[i]+min(i+1,mid)*a;

            if(temp+r[mid]<T)
                le=mid;
            else
                ri=mid;

        }

        if(temp+r[le]<=T)
            ma=max(ma,i+le+2);
        if(temp+r[ri]<=T)
            ma=max(ma,i+ri+2);

    }

    cout<<ma;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,b,T,i,j,temp,le,ri,mid,ma=0;
    cin>>n>>a>>b>>T;
    char str[n];
    cin>>str;

    int r[n],l[n];

    if(str[0]=='h')
        r[0]=1;
    else
        r[0]=b+1;

    for(i=1;i<n;i++){

        if(str[i]=='h')
            r[i]=r[i-1]+a+1;
        else
            r[i]=r[i-1]+a+b+1;

    }

    if(str[n-1]=='h')
        l[0]=a+1;
    else
        l[0]=a+b+1;

    for(i=1;i<n-1;i++){

        if(str[n-1-i]=='h')
            l[i]=l[i-1]+a+1;
        else
            l[i]=l[i-1]+a+b+1;

    }
    /*
    for(i=0;i<n;i++)
        cout<<r[i]<<" ";

    cout<<endl;

    for(i=0;i<n-1;i++)
        cout<<l[i]<<" ";

    cout<<endl;

    */

    for(i=0;i<n;i++)
        if(r[i]<=T)
            ma=max(ma,i+1);

    for(i=0;i<n-1;i++){

        temp=l[i];

        if(temp>=T)
            continue;

        le=0;
        ri=n-1-i-1;

        while(ri-le>1){

            mid=(le+ri)/2;

            temp+=min(i+1,mid)*a;

            if(temp+r[mid]<T)
                le=mid;
            else
                ri=mid;

        }

        if(temp+r[le]<=T)
            ma=max(ma,i+le+2);
        if(temp+r[ri]<=T)
            ma=max(ma,i+ri+2);

    }

    cout<<ma;

}


#define	_CRT_SECURE_NO_WARNINGS
#define	_USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

#define ft  first
#define sd  second
#define mp  make_pair
#define	pb	push_back

typedef long long int   ll;
typedef long double     ld;
typedef	pair<int, int>	ii;
typedef	vector<int>		vi;
typedef	vector<ii>		vii;

const int MAXN = 1000000;
const int MOD = 1000000007;
const int INF = 1000000010;
const ld EPS = 1e-6;

ll N, A, B, T;
char s[MAXN];

bool check(ll l) {
	ll ptra = 0, ptrb = 0;
	ll dt = l + (l-1LL) * A;
	while (ptrb - ptra < l) {
		if (s[ptrb] == 'w')
			dt += B;
		ptrb++;
	}

	if (dt < T)
		return true;

	while (ptrb > 0) {
		ptrb--;
		if (ptra == 0)
			ptra = N - 1LL;
		else
			ptra--;

		if (s[ptrb] == 'w')
			dt -= B;
		if (s[ptra] == 'w')
			dt += B;

		if (dt + min(ptrb-1, N - ptra)*A < T)
			return true;
	}

	return false;
}

int main() {
#ifdef  FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bb8.in", "r", stdin);
	//freopen("bb8.out", "w", stdout);
#endif // FILE_IO

	scanf("%I64d %I64d %I64d %I64d", &N, &A, &B, &T);
	scanf("%s", s);

	ll l = 0, r = N, m;
	while (l < r) {
		m = (l + r + 1LL) / 2LL;

		if (check(m))
			l = m;
		else
			r = m - 1LL;
	}

	printf("%I64d", l);

	return 0;
}


#define	_CRT_SECURE_NO_WARNINGS
#define	_USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

#define ft  first
#define sd  second
#define mp  make_pair
#define	pb	push_back

typedef long long int   ll;
typedef long double     ld;
typedef	pair<int, int>	ii;
typedef	vector<int>		vi;
typedef	vector<ii>		vii;

const int MAXN = 1000000;
const int MOD = 1000000007;
const int INF = 1000000010;
const ld EPS = 1e-6;

ll N, A, B, T;
char s[MAXN];

bool check(ll l) {
	ll ptra = 0, ptrb = 0;
	ll dt = l + (l-1LL) * A;
	while (ptrb - ptra < l) {
		if (s[ptrb] == 'w')
			dt += B;
		ptrb++;
	}

	if (dt <= T)
		return true;

	while (ptrb > 1) {
		ptrb--;
		if (ptra == 0)
			ptra = N - 1LL;
		else
			ptra--;

		if (s[ptrb] == 'w')
			dt -= B;
		if (s[ptra] == 'w')
			dt += B;

		if (dt + min(ptrb-1, N - ptra)*A <= T)
			return true;
	}

	return false;
}

int main() {
#ifdef  FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bb8.in", "r", stdin);
	//freopen("bb8.out", "w", stdout);
#endif // FILE_IO

	scanf("%I64d %I64d %I64d %I64d", &N, &A, &B, &T);
	scanf("%s", s);

	ll l = 0, r = N, m;
	while (l < r) {
		m = (l + r + 1LL) / 2LL;

		if (check(m))
			l = m;
		else
			r = m - 1LL;
	}

	printf("%I64d", l);

	return 0;
}


#define	_CRT_SECURE_NO_WARNINGS
#define	_USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

#define ft  first
#define sd  second
#define mp  make_pair
#define	pb	push_back

typedef long long int   ll;
typedef long double     ld;
typedef	pair<int, int>	ii;
typedef	vector<int>		vi;
typedef	vector<ii>		vii;

const int MAXN = 2000;
const int MOD = 1000000007;
const int INF = 1000000010;
const ld EPS = 1e-6;

int N, A, B, T;
char s[MAXN];

bool check(int l) {
	int ptra = 0, ptrb = 0;
	int dt = l;
	while (ptrb - ptra < l) {
		if (s[ptrb] == 'w')
			dt += B;
		ptrb++;
	}

	if (dt + (l-1)*A < T)
		return true;

	while (ptrb >= 0) {
		ptrb--;
		if (ptra == 0)
			ptra = N - 1;
		else
			ptra--;

		if (s[ptrb] == 'w')
			dt -= B;
		if (s[ptra] == 'w')
			dt += B;

		if (dt + (l - 1)*A + min(ptrb, N - ptra) < T)
			return true;
	}

	return false;
}

int main() {
#ifdef  FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bb8.in", "r", stdin);
	//freopen("bb8.out", "w", stdout);
#endif // FILE_IO

	scanf("%d %d %d %d", &N, &A, &B, &T);
	scanf("%s", s);

	int l = 0, r = N, m;
	while (l < r) {
		m = (l + r + 1) / 2;

		if (check(m))
			l = m;
		else
			r = m - 1;
	}

	printf("%d", l);

	return 0;
}


#define	_CRT_SECURE_NO_WARNINGS
#define	_USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

#define ft  first
#define sd  second
#define mp  make_pair
#define	pb	push_back

typedef long long int   ll;
typedef long double     ld;
typedef	pair<int, int>	ii;
typedef	vector<int>		vi;
typedef	vector<ii>		vii;

const int MAXN = 1000000;
const int MOD = 1000000007;
const int INF = 1000000010;
const ld EPS = 1e-6;

ll N, A, B, T;
char s[MAXN];

bool check(ll l) {
	ll ptra = 0, ptrb = 0;
	ll dt = l + (l-1LL) * A;
	while (ptrb - ptra < l) {
		if (s[ptrb] == 'w')
			dt += B;
		ptrb++;
	}

	if (dt < T)
		return true;

	while (ptrb >= 0) {
		ptrb--;
		if (ptra == 0)
			ptra = N - 1LL;
		else
			ptra--;

		if (s[ptrb] == 'w')
			dt -= B;
		if (s[ptra] == 'w')
			dt += B;

		if (dt + min(ptrb, N - ptra)*A < T)
			return true;
	}

	return false;
}

int main() {
#ifdef  FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bb8.in", "r", stdin);
	//freopen("bb8.out", "w", stdout);
#endif // FILE_IO

	scanf("%I64d %I64d %I64d %I64d", &N, &A, &B, &T);
	scanf("%s", s);

	ll l = 0, r = N, m;
	while (l < r) {
		m = (l + r + 1LL) / 2LL;

		if (check(m))
			l = m;
		else
			r = m - 1LL;
	}

	printf("%I64d", l);

	return 0;
}


#define	_CRT_SECURE_NO_WARNINGS
#define	_USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

#define ft  first
#define sd  second
#define mp  make_pair
#define	pb	push_back

typedef long long int   ll;
typedef long double     ld;
typedef	pair<int, int>	ii;
typedef	vector<int>		vi;
typedef	vector<ii>		vii;

const int MAXN = 1000000;
const int MOD = 1000000007;
const int INF = 1000000010;
const ld EPS = 1e-6;

ll N, A, B, T;
char s[MAXN];

bool check(ll l) {
	ll ptra = 0, ptrb = 0;
	ll dt = l + (l-1LL) * A;
	while (ptrb - ptra < l) {
		if (s[ptrb] == 'w')
			dt += B;
		else
			puts("WOW");
		ptrb++;
	}

	if (dt < T)
		return true;

	while (ptrb >= 0) {
		ptrb--;
		if (ptra == 0)
			ptra = N - 1LL;
		else
			ptra--;

		if (s[ptrb] == 'w')
			dt -= B;
		if (s[ptra] == 'w')
			dt += B;

		if (dt + min(ptrb, N - ptra)*A < T)
			return true;
	}

	return false;
}

int main() {
#ifdef  FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bb8.in", "r", stdin);
	//freopen("bb8.out", "w", stdout);
#endif // FILE_IO

	scanf("%I64d %I64d %I64d %I64d", &N, &A, &B, &T);
	scanf("%s", s);

	ll l = 0, r = N, m;
	while (l < r) {
		m = (l + r + 1LL) / 2LL;

		if (check(m))
			l = m;
		else
			r = m - 1LL;
	}

	printf("%I64d", l);

	return 0;
}


#define	_CRT_SECURE_NO_WARNINGS
#define	_USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

#define ft  first
#define sd  second
#define mp  make_pair
#define	pb	push_back

typedef long long int   ll;
typedef long double     ld;
typedef	pair<int, int>	ii;
typedef	vector<int>		vi;
typedef	vector<ii>		vii;

const int MAXN = 1000000;
const int MOD = 1000000007;
const int INF = 1000000010;
const ld EPS = 1e-6;

int N, A, B, T;
char s[MAXN];

bool check(int l) {
	int ptra = 0, ptrb = 0;
	int dt = l;
	while (ptrb - ptra < l) {
		if (s[ptrb] == 'w')
			dt += B;
		ptrb++;
	}

	if (dt + (l-1)*A < T)
		return true;

	while (ptrb >= 0) {
		ptrb--;
		if (ptra == 0)
			ptra = N - 1;
		else
			ptra--;

		if (s[ptrb] == 'w')
			dt -= B;
		if (s[ptra] == 'w')
			dt += B;

		if (dt + (l - 1)*A + min(ptrb, N - ptra) < T)
			return true;
	}

	return false;
}

int main() {
#ifdef  FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bb8.in", "r", stdin);
	//freopen("bb8.out", "w", stdout);
#endif // FILE_IO

	scanf("%d %d %d %d", &N, &A, &B, &T);
	scanf("%s", s);

	int l = 0, r = N, m;
	while (l < r) {
		m = (l + r + 1) / 2;

		if (check(m))
			l = m;
		else
			r = m - 1;
	}

	printf("%d", l);

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 6;
int suffix[3][MAXN];
int n, a, b, m;
char str[MAXN];
int toI(char c)
{
    if(c == 'w') return 1;
    else return 2;
}
void init()
{
    suffix[1][n] = suffix[2][n] = 0;
    for(int k = 1 ; k <= 2 ; k++) {
        int pre = k;
        for(int i = n - 1 ; i >= 0 ; i--) {
            suffix[k][i] = suffix[k][i + 1] + a;
            if(toI(str[i]) != pre) {
                suffix[k][i] += b;
                pre = str[i];
            }
        }
    }
}
int main()
{
    scanf("%d%d%d%d", &n, &a, &b, &m);
        scanf("%s", str);
        init();
        int now = 0;
        int ans = 0;
        int pre = 2;
        int cost1 = 0;
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) != pre) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[pre][now] + a * (i + 1) > m) now++;
            if(cost1 + suffix[pre][now] + a * (i + 1) > m) {
                if(cost1 < m) ans = max(ans, i + 1);
                else break;
            }
            else
                ans = max(ans, i + 1 + (n - now));
        }

        int len = strlen(str);
        for(int i = 1 ; i < (len + 1) / 2 ; i++) swap(str[i], str[len - i]);
//        cout <<str << endl;
        init();
        now = 0;
        pre = 2;
        cost1 = 0;
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) != pre) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[pre][now] + a * (i + 1) > m) now++;
            if(cost1 + suffix[pre][now] + a * (i + 1) > m) {
                if(cost1 < m) ans = max(ans, i + 1);
                else break;
            }
            else
                ans = max(ans, i + 1 + (n - now));
        }

        printf("%d\n", ans);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 6;
int suffix[MAXN];
int n, a, b, m;
char str[MAXN];
int toI(char c)
{
    if(c == 'w') return 1;
    else return 2;
}
void init()
{
    suffix[n] = 0;
    for(int i = n - 1 ; i >= 0 ; i--) {
        suffix[i] = suffix[i + 1] + a + 1;
        if(toI(str[i]) != 2) {
            suffix[i] += b;
        }
    }
}
int main()
{
//    while(1) {
    scanf("%d%d%d%d", &n, &a, &b, &m);
        scanf("%s", str);
        init();
        int now = 0;
        int ans = 0;
        int pre = 2;
        int cost1 = 0;
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) == 1) {
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[now] + a * i > m) now++;
            if(cost1 + suffix[now] + a * i > m) {
                if(cost1 < m) ans = max(ans, i + 1);
                else break;
            }
            else
                ans = max(ans, i + 1 + (n - now));
//            printf("i = %d, now = %d\n", i, now);
        }

        int len = strlen(str);
        for(int i = 1 ; i < (len + 1) / 2 ; i++) swap(str[i], str[len - i]);
//        cout <<str << endl;
        init();
        now = 0;
        pre = 2;
        cost1 = 0;
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) == 1) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[now] + a * i > m) now++;
            if(cost1 + suffix[now] + a * i > m) {
                if(cost1 < m) ans = max(ans, i + 1);
                else break;
            }
            else
                ans = max(ans, i + 1 + (n - now));
//            printf("i = %d, now = %d\n", i, now);
        }

        printf("%d\n", ans);
//    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 6;
int suffix[3][MAXN];
int n, a, b, m;
char str[MAXN];
int toI(char c)
{
    if(c == 'w') return 1;
    else return 2;
}
void init()
{
    suffix[1][n] = suffix[2][n] = 0;
    for(int k = 1 ; k <= 2 ; k++) {
        int pre = k;
        for(int i = n - 1 ; i >= 0 ; i--) {
            suffix[k][i] = suffix[k][i + 1] + a;
            if(toI(str[i]) != pre) {
                suffix[k][i] += b;
                pre = str[i];
            }
        }
    }
}
int main()
{
    while(scanf("%d%d%d%d", &n, &a, &b, &m)) {
        scanf("%s", str);
        init();
        int now = 0;
        int ans = 0;
        int pre = 2;
        int cost1 = 0;
        while(now <= n && cost1 + suffix[pre][now] + a * 1 > m) now++;
        if(suffix[pre][now] <= m) ans = max(ans, n - now);
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) != pre) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[pre][now] + a * (i + 1) > m) now++;
            if(cost1 + suffix[pre][now] + a * (i + 1) > m) break;
            ans = max(ans, i + 1 + (n - now));
        }
        printf("%d\n", ans);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 6;
int suffix[3][MAXN];
int n, a, b, m;
char str[MAXN];
int toI(char c)
{
    if(c == 'w') return 1;
    else return 2;
}
void init()
{
    suffix[1][n] = suffix[2][n] = 0;
    for(int k = 1 ; k <= 2 ; k++) {
        int pre = k;
        for(int i = n - 1 ; i >= 0 ; i--) {
            suffix[k][i] = suffix[k][i + 1] + a;
            if(toI(str[i]) != pre) {
                suffix[k][i] += b;
                pre = str[i];
            }
        }
    }
}
int main()
{
    scanf("%d%d%d%d", &n, &a, &b, &m);
        scanf("%s", str);
        init();
        int now = 0;
        int ans = 0;
        int pre = 2;
        int cost1 = 0;
        while(now < n && cost1 + suffix[pre][now] + a * 1 > m) now++;
        if(suffix[pre][now] <= m) ans = max(ans, n - now);
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) != pre) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[pre][now] + a * (i + 1) > m) now++;
            if(cost1 + suffix[pre][now] + a * (i + 1) > m) break;
            ans = max(ans, i + 1 + (n - now));
        }

        int len = strlen(str);
        for(int i = 1 ; i < (len + 1) / 2 ; i++) swap(str[i], str[len - i]);
//        cout <<str << endl;
        init();
        now = 0;
        pre = 2;
        cost1 = 0;
        while(now < n && cost1 + suffix[pre][now] + a * 1 > m) now++;
        if(suffix[pre][now] <= m) ans = max(ans, n - now);
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) != pre) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[pre][now] + a * (i + 1) > m) now++;
            if(cost1 + suffix[pre][now] + a * (i + 1) > m) break;
            ans = max(ans, i + 1 + (n - now));
        }

        printf("%d\n", ans);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 6;
int suffix[3][MAXN];
int n, a, b, m;
char str[MAXN];
int toI(char c)
{
    if(c == 'w') return 1;
    else return 2;
}
void init()
{
    suffix[1][n] = suffix[2][n] = 0;
    for(int k = 1 ; k <= 2 ; k++) {
        int pre = k;
        for(int i = n - 1 ; i >= 0 ; i--) {
            suffix[k][i] = suffix[k][i + 1] + a;
            if(toI(str[i]) != pre) {
                suffix[k][i] += b;
                pre = str[i];
            }
        }
    }
}
int main()
{
    scanf("%d%d%d%d", &n, &a, &b, &m);
        scanf("%s", str);
        init();
        int now = 0;
        int ans = 0;
        int pre = 2;
        int cost1 = 0;
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) != pre) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[pre][now] + a * (i + 1) > m) now++;
            if(cost1 + suffix[pre][now] + a * (i + 1) > m) break;
            ans = max(ans, i + 1 + (n - now));
        }

        int len = strlen(str);
        for(int i = 1 ; i < (len + 1) / 2 ; i++) swap(str[i], str[len - i]);
//        cout <<str << endl;
        init();
        now = 0;
        pre = 2;
        cost1 = 0;
        for(int i = 0 ; i < n ; i++) {
            cost1 +=  1 + a;
            if(i == 0) cost1 -= a;
            if(toI(str[i]) != pre) {
                pre = toI(str[i]);
                cost1 += b;
            }
            while(now <= i) now++;
            while(now < n && cost1 + suffix[pre][now] + a * (i + 1) > m) now++;
            if(cost1 + suffix[pre][now] + a * (i + 1) > m) break;
            ans = max(ans, i + 1 + (n - now));
        }

        printf("%d\n", ans);

    return 0;
}