//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    while (l <= r) {
        int mid = (l + r) >> 1;
        LL expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += (LL)a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] <= T) {
            int indx = find(i + 1, n - 1, i);
            ans = max(ans, n - indx + i + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense <= T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        if (R[i] > T) break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return l;
    while (l <= r) {
        int mid = (l + r) >> 1;
        LL expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += (LL)a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense <= T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i=0;i<n;i++)
        if (R[i]<=T)
        {
            int l=i+1,r=n-1;
            while (l<=r)
            {
                int mid=(l+r)>>1;
                if (R[i]+L[mid]+min(i,n-mid)*a<=T) r=mid-1; else l=mid+1;
            }
            ans=max(ans,i+1+n-l);
        }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        if (R[i] > T) break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int fuck = l, shit = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l < fuck || l > shit) return n;
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T)  break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);

    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return n;
    }
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] <= T) {
            int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    while (l <= r) {
        int mid = (l + r) >> 1;
        // LL expense = R[rightDis] +L[mid]+min(rightDis,n-mid)*a;
        LL expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += (LL)a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        if (R[i] <= T) {
            int indx = find(i + 1, n - 1, i);
            ans = max(ans, n - indx + i + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    while (l <= r) {
        int mid = (l + r) >> 1;
        LL expense = R[rightDis]+L[mid]+min(rightDis,n-mid)*a;
        // int leftDis = n - mid;
        // expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        if (R[i] <= T) {
            int indx = find(i + 1, n - 1, i);
            ans = max(ans, n - indx + i + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    while (l <= r) {
        int mid = (l + r) >> 1;
        LL expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += (LL)a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T)  break;
            int indx = find(i + 1, n - 1, i);
            ans = max(ans, n - indx + i + 1);

    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T)  break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);

    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return l;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense <= T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        if (R[i] > T) break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return n;
    }
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T) continue;
        ans = max(ans, n - indx + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l < a || l > b) return n;
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T)  break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);

    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        LL expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += (LL)a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return n;
    }
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] <= T) {
            int indx = find(i + 1, n - 1, i);
            ans = max(ans, n - indx + i + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return n;
    }
}

int find2(int l, int r, int leftDis) {
    int a = l, b = r;
    if (l > r) return 0;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[leftDis] + R[mid];
        int rightDis = mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            r = mid - 1;
        } else if (expense < T) {
            l = mid +1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return 0;
    }
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << L[i] << " " << R[i] << endl;
    // }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        int indx = find(i + 1, n - 1, i);
        if (R[i] > T) continue;
        ans = max(ans, n - indx + i + 1);
    }
    // cout<< ans << endl;
    for (int i = n - 1; i >= 1; -- i) {
        int indx = find2(0, i - 1, n - i);
        // cout << indx << " " << i << endl;
        if (L[i] + R[0] > T || indx < 0) continue;
        ans = max(ans, n - i + indx + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int sum[N];

bool check(int v) {
  for(int l = 0; l < v; l++) {
    int r = v - l;
    if (r <= 0) continue;
    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() {
    cin >> n >> a >> b >> T >> circle;
    sum[0] = 0;
    for (int i = 0; i < n; ++ i) {
        sum[i + 1] = sum[i] + (circle[i] == 'w') * b + 1;
    }
    int l = 0, r = n + 1;
    while (r - l > 1) {
        int mid = (l + r) >> 1;
        if (check(mid)) l = mid;
        else            r = mid;
    }
    cout << l << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int sum[N];

bool check(int v) {
  for(int l = 0; l < v; l++) {
    int r = v - l;
    if (r <= 0) continue;
    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() {
    cin >> n >> a >> b >> T >> circle;
    sum[0] = (circle[0] == 'w') * b + 1;
    for (int i = 1; i <= n; ++ i) {
        sum[i] = sum[i - 1] + (circle[i] == 'w') * b + 1;
    }
    int l = 0, r = n + 1;
    while (r - l > 1) {
        int mid = (l + r) >> 1;
        if (check(mid)) l = mid;
        else            r = mid;
    }
    cout << l << endl;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

set<string> same;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlookh(n), rlookw(n);
	char cur_orent = 'h';

	rlookh[0] = (cur_orent == orent[0] ? 0 : b);

	rlookh[n - 1] = 2 + a + (cur_orent == orent[n - 1] ? 0 : b) + rlookh[0];
	cur_orent = orent[n - 1];

	for (int i = n-2; i > 0; i--)
	{
		rlookh[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + rlookh[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'w';

	rlookw[0] = (cur_orent == orent[0] ? 0 : b);

	rlookw[n - 1] = 2 + a + (cur_orent == orent[n - 1] ? 0 : b) + rlookw[0];
	cur_orent = orent[n - 1];

	for (int i = n - 2; i > 0; i--)
	{
		rlookw[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + rlookw[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'h';
	look[0] = (cur_orent == orent[0] ? 0 : b);
	for (int i = 1; i < n; i++)
	{
		look[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + look[i - 1];
		cur_orent = orent[i];
	}
	T--;
	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = T - look[i] - a*i;

		if (avalT <= 0 || an == n)
			break;
		bool is_h=false;
		if (orent[i] == 'h')
			is_h = true;
		int r = n - 1, l=min(i+1,(int)n-1),m=(r+l)/2;

		while (r - l > 1)
		{
			if (is_h)
			{
				if (rlookh[m] > avalT)
					l = m;
				else
					r = m;
			}
			else
			{
				if (rlookw[m] > avalT)
					l = m;
				else
					r = m;
			}

			m = (r + l) / 2;
		}
		if (is_h)
		{
			if (rlookh[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookh[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}
		else
		{
			if (rlookw[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookw[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}

	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlookh(n), rlookw(n);

	char cur_orent = 'h';

	rlookh[0] = 0;

	rlookh[n - 1] = 1 + a + (cur_orent == orent[n - 1] ? 0 : b);
	cur_orent = orent[n - 1];

	for (int i = n-2; i > 0; i--)
	{
		rlookh[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + rlookh[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'w';

	rlookw[0] = 0;

	rlookw[n - 1] = 1 + a + (cur_orent == orent[n - 1] ? 0 : b);
	cur_orent = orent[n - 1];

	for (int i = n - 2; i > 0; i--)
	{
		rlookw[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + rlookw[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'h';
	look[0] = (cur_orent == orent[0] ? 0 : b) + 1;
	for (int i = 1; i < n; i++)
	{
		look[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + look[i - 1];
		cur_orent = orent[i];
	}

	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = T - look[i] - a*i;

		if (avalT <= 0 || an == n)
			break;

		bool is_h=false;
		if (orent[i] == 'h')
			is_h = true;

		int r = n - 1, l=min(i+1,(int)n-1),m=(r+l)/2;

		while (r - l > 1)
		{
			if (is_h)
			{
				if (rlookh[m] > avalT)
					l = m;
				else
					r = m;
			}
			else
			{
				if (rlookw[m] > avalT)
					l = m;
				else
					r = m;
			}

			m = (r + l) / 2;
		}
		if (is_h)
		{
			if (rlookh[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookh[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}
		else
		{
			if (rlookw[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookw[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}

	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlook(n);

	rlook[0] = 0;
	rlook[n - 1] = 1 + a + ('h' == orent[n - 1] ? 0 : b);
	for (int i = n-2; i > 0; i--)
	{
		rlook[i] = (long long)1 + a + ('h' == orent[i] ? 0 : b) + rlook[i + 1];
	}

	look[0] = ('h' == orent[0] ? 0 : b) + 1;
	for (int i = 1; i < n; i++)
	{
		look[i] = (long long)1 + a + ('h' == orent[i] ? 0 : b) + look[i - 1];
	}

	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = look[i] + a*i;

		if (avalT <= 0 || an == n)
			break;

		int r = n - 1, l=min(i+1,(int)n-1), m=(r+l)/2;

		while (r - l > 1)
		{

				if (rlook[m] + avalT < T)
					r = m;
				else
					l = m;

			m = (r + l) / 2;
		}

			if (rlook[r] + avalT <= T)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlook[l] + avalT <= T)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}

	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlookh(n), rlookw(n);

	char cur_orent = 'h';

	rlookh[0] = 0;

	rlookh[n - 1] =  a + (cur_orent == orent[n - 1] ? 0 : b);
	cur_orent = orent[n - 1];

	for (int i = n-2; i > 0; i--)
	{
		rlookh[i] = a + (cur_orent == orent[i] ? 0 : b) + rlookh[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'w';

	rlookw[0] = 0;

	rlookw[n - 1] =  a + (cur_orent == orent[n - 1] ? 0 : b);
	cur_orent = orent[n - 1];

	for (int i = n - 2; i > 0; i--)
	{
		rlookw[i] = a + (cur_orent == orent[i] ? 0 : b) + rlookw[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'h';
	look[0] = (cur_orent == orent[0] ? 0 : b) + 1;
	for (int i = 1; i < n; i++)
	{
		look[i] =  a + (cur_orent == orent[i] ? 0 : b) + look[i - 1];
		cur_orent = orent[i];
	}

	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = T - look[i] - a*i;

		if (avalT <= 0 || an == n)
			break;

		bool is_h=false;
		if (orent[i] == 'h')
			is_h = true;

		int r = n - 1, l=min(i+1,(int)n-1),m=(r+l)/2;

		while (r - l > 1)
		{
			if (is_h)
			{
				if (rlookh[m] > avalT)
					l = m;
				else
					r = m;
			}
			else
			{
				if (rlookw[m] > avalT)
					l = m;
				else
					r = m;
			}

			m = (r + l) / 2;
		}
		if (is_h)
		{
			if (rlookh[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookh[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}
		else
		{
			if (rlookw[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookw[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}

	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

set<string> same;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlookh(n), rlookw(n);
	char cur_orent = 'h';

	rlookh[0] = (cur_orent == orent[0] ? 0 : b);

	rlookh[n - 1] = 2 + a + (cur_orent == orent[n - 1] ? 0 : b) + rlookh[0];
	cur_orent = orent[n - 1];

	for (int i = n-2; i > 0; i--)
	{
		rlookh[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + rlookh[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'w';

	rlookw[0] = (cur_orent == orent[0] ? 0 : b);

	rlookw[n - 1] = 2 + a + (cur_orent == orent[n - 1] ? 0 : b) + rlookw[0];
	cur_orent = orent[n - 1];

	for (int i = n - 2; i > 0; i--)
	{
		rlookw[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + rlookw[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'h';
	look[0] = (cur_orent == orent[0] ? 0 : b);
	for (int i = 1; i < n; i++)
	{
		look[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + look[i - 1];
		cur_orent = orent[i];
	}
	T--;
	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = T - look[i] - a*i;

		if (avalT <= 0 || an == n)
			break;
		bool is_h=false;
		if (orent[i] == 'h')
			is_h = true;
		int r = n - 1, l=min(i+1,(int)n-1),m=(r+l)/2;

		while (r - l > 1)
		{
			if (is_h)
			{
				if (rlookh[m] > avalT)
					l = m;
				else
					r = m;
			}
			else
			{
				if (rlookw[m] > avalT)
					l = m;
				else
					r = m;
			}

			m = (r + l) / 2;
		}
		if (is_h)
		{
			if (rlookh[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookh[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}
		else
		{
			if (rlookh[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlookh[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
		}

	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlook(n);

	rlook[0] = 0;

	rlook[n - 1] = 1 + a + ('h' == orent[n - 1] ? 0 : b);

	for (int i = n-2; i > 0; i--)
	{
		rlook[i] = 1 + a + ('h' == orent[i] ? 0 : b) + rlook[i + 1];
	}

	look[0] = ('h' == orent[0] ? 0 : b) + 1;
	for (int i = 1; i < n; i++)
	{
		look[i] = 1 + a + ('h' == orent[i] ? 0 : b) + look[i - 1];
	}

	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = T - look[i] - a*i;

		if (avalT <= 0 || an == n)
			break;

		int r = n - 1, l=min(i+1,(int)n-1),m=(r+l)/2;

		while (r - l > 1)
		{

				if (rlook[m] > avalT)
					l = m;
				else
					r = m;

			m = (r + l) / 2;
		}

			if (rlook[r] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlook[l] <= avalT)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}

	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlook(n);

	rlook[0] = 0;
	rlook[n - 1] = 1 + a + ('h' == orent[n - 1] ? 0 : b);
	for (int i = n-2; i > 0; i--)
	{
		rlook[i] = (long long)1 + a + ('h' == orent[i] ? 0 : b) + rlook[i + 1];
	}

	look[0] = ('h' == orent[0] ? 0 : b) + 1;
	for (int i = 1; i < n; i++)
	{
		look[i] = (long long)1 + a + ('h' == orent[i] ? 0 : b) + look[i - 1];
	}

	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = look[i] + a*i;

		if (avalT <= 0 || an == n)
			break;

		int r = n - 1, l=min(i+1,(int)n-1), m=(r+l)/2;

		while (r - l > 1)
		{

				if (rlook[m] + avalT < T)
					r = m;
				else
					l = m;

			m = (r + l) / 2;
		}

			if (rlook[r] + avalT <= T)
			{
				an = max(an, (i + 1) + (int)(n - r));
			}
			if (rlook[l] + avalT <= T)
			{
				an = max(an, (i + 1) + (int)(n - l));
			}
	}
	///rev
	for (int i = n-1; i > 0; i--)
	{
		if (T >= rlook[i] + look[0])
			an = max(an, (int)n-i);

		long long avalT = rlook[i] + a*(n - i) + look[0];

		if (avalT <= 0 || an == n)
			break;

		int r = i, l = 1, m = (r + l) / 2;

		while (r - l > 1)
		{

			if (look[m] + avalT - look[0] > T)
				r = m;
			else
				l = m;

			m = (r + l) / 2;
		}

		if (look[r] + avalT - look[0] <= T)
		{
			an = max(an,r + (int)(n -i));
		}
		if (look[l] + avalT - look[0] <= T)
		{
			an = max(an, l+1 + (int)(n - i));
		}
	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlook(n);

	rlook[0] = 0;

	rlook[n - 1] = 1 + a + ('h' == orent[n - 1] ? 0 : b);
	for (int i = n-2; i > 0; i--)
	{
		rlook[i] = (long long)1 + a + ('h' == orent[i] ? 0 : b) + rlook[i + 1];
	}

	look[0] = ('h' == orent[0] ? 0 : b) + 1;
	for (int i = 1; i < n; i++)
	{
		look[i] = (long long)1 + a + ('h' == orent[i] ? 0 : b) + look[i - 1];
	}

	long long an = 0;
	for (long long i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = T - look[i] - a*i;

		if (avalT <= 0 || an == n)
			break;

		int r = n - 1, l=min(i+1,n-1),m=(r+l)/2;

		while (r - l > 1)
		{

				if (rlook[m] > avalT)
					l = m;
				else
					r = m;

			m = (r + l) / 2;
		}

			if (rlook[r] <= avalT)
			{
				an = max(an, (i + 1) + (n - r));
			}
			if (rlook[l] <= avalT)
			{
				an = max(an, (i + 1) + (n - l));
			}

	}
	cout << an;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;
int count_n = 0;

set<string> same;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long n, a,b,T;
	cin >> n >> a >> b >> T;
	string orent;
	cin >> orent;
	vector<long long> look(n), rlook(n);
	char cur_orent = 'h';

	rlook[0] = (cur_orent == orent[0] ? 0 : b);

	rlook[n - 1] = 2 + a + (cur_orent == orent[n - 1] ? 0 : b) + rlook[0];
	cur_orent = orent[n - 1];

	for (int i = n-2; i > 0; i--)
	{
		rlook[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + rlook[i + 1];
		cur_orent = orent[i];
	}

	cur_orent = 'h';
	look[0] = (cur_orent == orent[0] ? 0 : b);
	for (int i = 1; i < n; i++)
	{
		look[i] = 1 + a + (cur_orent == orent[i] ? 0 : b) + look[i - 1];
		cur_orent = orent[i];
	}
	T--;
	int an = 0;
	for (int i = 0; i < n; i++)
	{
		if (T >= look[i])
			an = max(an, i + 1);

		long long avalT = T - look[i] - a*i;

		if (avalT <= 0 || an == n)
			break;

		int r = n - 1, l=min(i+1,(int)n-1),m=(r+l)/2;

		while (r - l > 1)
		{
			if (rlook[m] > avalT)
				l = m;
			else
				r = m;
			m = (r + l) / 2;
		}
		if (rlook[r] <= avalT)
		{
			an = max(an, (i + 1) + (int)(n - r));
		}
		if (rlook[l] <= avalT)
		{
			an = max(an, (i + 1) + (int)(n - l));
		}
	}
	cout << an;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 1;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e,int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, int with) {
	with -= (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		ll need = 1LL * w * b + mid + 1LL * (mid - 1) * a;
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0;
	ll need = 0;
	for (int i = 0; i < n; ++i) {
		need += (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	printf("%d\n", res);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 10;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e, int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, int with) {
	with -= 1LL * (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		assert(w + h == mid);
		ll need = (1LL * w * b) + mid + (1LL * (mid - 1) * a);
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0;
	ll need = 0;
	for (int i = 0; i < n && need <= T; ++i) {
		need += (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	assert(res <= n);
	printf("%d\n", res);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 10;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e, int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, int with) {
	with -= (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		assert(w + h == mid);
		ll need = (1LL * w * b) + mid + 1LL * (mid - 1) * a;
		if (need <= with) {
			l = mid + 1;
			res = mid;
		}
		else
			r = mid - 1;
	}
	return res;
}

int go(int from, int with) {
	if (from != 0)
		with -= (n - from) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (mid >= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(mid, 1, 0);
		int h = calc(mid, 1, 1);
		int need = w * b + mid + mid * a;
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0;
	ll need = 0;
	for (int i = 0; i < n && need <= T; ++i) {
		need += (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	need = 0;
	int at = 0, take = 0;
	while (take != n) {
		need += (s[at] == 'w') * b + 1;
		if (need > T)
			break;
		++take;
		res = max(res, take + go(at, T - need));
		need += a;
		if (--at == -1)
			at = n - 1;
	}
	assert(res <= n);
	printf("%d\n", res);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 10;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e, int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, ll with) {
	with -= 1LL * (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		assert(w + h == mid);
		ll need = (1LL * w * b) + mid + (1LL * (mid - 1) * a);
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0;
	ll need = 0;
	for (int i = 0; i < n && need <= T; ++i) {
		need += (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	assert(res <= n);
	printf("%d\n", res);
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 1;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e,int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, int with) {
	with -= (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		int need = w * b + mid + (mid - 1) * a;
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0, need = 0;
	for (int i = 0; i < n; ++i) {
		need += (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	printf("%d\n", res);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 10;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e, int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, int with) {
	with -= (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		assert(w + h == mid);
		ll need = (1LL * w * b) + mid + 1LL * (mid - 1) * a;
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int go(int from, int with) {
	with -= (n - from) * a;
	if (with <= 0)
		return 0;
	int l = 0, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (mid >= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(1, mid, 0);
		int h = calc(1, mid, 1);
		int need = w * b + mid + mid * a;
		if (need <= with) {
			l = mid + 1;
			res = mid;
		}
		else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0;
	ll need = 0;
	for (int i = 0; i < n && need <= T; ++i) {
		need += (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	need = 0;
	int at = 0, take = 0;
	while (take != n) {
		need += (s[at] == 'w') * b + 1;
		if (need > T)
			break;
		++take;
		res = max(res, take + go(at, T - need));
		need += a;
		if (--at == -1)
			at = n - 1;
	}
	assert(res <= n);
	printf("%d\n", res);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 10;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e, int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, ll with) {
	with -= 1LL * (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		assert(w + h == mid);
		ll need = (1LL * w * b) + mid + (1LL * (mid - 1) * a);
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0;
	ll need = 0;
	for (int i = 0; i < n && need <= T; ++i) {
		need += (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	assert(res <= n);
	printf("%d\n", res);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
using namespace std;

typedef long long ll;

const int N = 5e5 + 10;
int n, a, b, T, cum[N][2];
char s[N];

inline int calc(int s, int e, int T) {
	return  cum[s][T] - (e > 0 ? cum[e - 1][T] : 0);
}

int back(int from, int with) {
	with -= (from + 1) * a;
	if (with <= 0)
		return 0;
	int l = 1, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (n - mid <= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(n - 1, n - mid, 0);
		int h = calc(n - 1, n - mid, 1);
		assert(w + h == mid);
		ll need = (1LL * w * b) + mid + (1LL * (mid - 1) * a);
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int go(int from, int with) {
	with -= (n - from) * a;
	if (with <= 0)
		return 0;
	int l = 0, r = n, res = 0;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (mid >= from) {
			r = mid - 1;
			continue;
		}
		int w = calc(1, mid, 0);
		int h = calc(1, mid, 1);
		ll need = (1LL * w * b) + mid + (1LL * mid * a);
		if (need <= with) {
			l = mid + 1;
			res = mid;
		} else
			r = mid - 1;
	}
	return res;
}

int main(int argc, char **argv) {
//	freopen("in.txt", "r", stdin);
	scanf("%d%d%d%d%s", &n, &a, &b, &T, s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'w')
			++cum[i][0];
		else
			++cum[i][1];
		if (i != 0) {
			cum[i][0] += cum[i - 1][0];
			cum[i][1] += cum[i - 1][1];
		}
	}
	int res = 0;
	ll need = 0;
	for (int i = 0; i < n && need <= T; ++i) {
		need += 1LL * (s[i] == 'w') * b + 1;
		if (need > T)
			break;
		res = max(res, i + 1 + back(i, T - need));
		need += a;
	}
	int at = 0, take = 0;
	while (take != n) {
		need += 1LL * (s[at] == 'w') * b + 1;
		if (need > T)
			break;
		++take;
		res = max(res, take + go(at, T - need));
		need += a;
		--at;
		if (at == -1)
			at = n - 1;
	}
	assert(res <= n);
	printf("%d\n", res);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define pb push_back
#define mx 1000005
char str[mx];
int main()
{
	ll n,a,b,T;
	s2(n,a);
	s2(b,T);

	string tstr;
	cin>>tstr;

	ll j=1;
	ll t=1;
	if(tstr[0]=='w')t += b;

	for(ll i=1;i<n;i++)str[j++]=tstr[i];
	for(ll i=0;i<n;i++)str[j++]=tstr[i] ;
	str[j]='\0';

	ll lptr=n;
	ll rptr=n;
	ll cptr=n;
	ll nop=1;
	if(t>T)nop=0;
	if(t==T)nop=1;

	while(t<T)
	{
		if(rptr-lptr==n-1)break;
//		if(t==T)break;
		if(lptr==1)
		{
			ll rtemp=a+1;
			if(str[rptr+1]=='w')rtemp +=b;
			cptr=rptr+1;rptr++; t+= rtemp;

		}
		else if(rptr==n)
		{
			ll ltemp=a+1;
			if(str[lptr-1]=='w')ltemp +=b;
			cptr=lptr-1 ;lptr-- ; t+=ltemp;
		}
		else if(cptr==rptr)
		{

			ll rtemp=a+1;
			ll ltemp=(rptr-lptr+1)*a +1 ;
			if(str[cptr+1]=='w')rtemp +=b;
			if(str[lptr-1]=='w')ltemp +=b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		else if(cptr==lptr)
		{
			ll ltemp=a+1;
			ll rtemp=(rptr-lptr+1)*a + 1 ;
			if(str[cptr-1]=='w')ltemp += b;
			if(str[rptr+1]=='w') rtemp += b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t -= min(rtemp,ltemp) ;
		}
		nop++ ;
	}
	p(nop);

}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define pb push_back
#define mx 1000005
char str[mx];
int main()
{
	ll n,a,b,T;
	s2(n,a);
	s2(b,T);

	string tstr;
	cin>>tstr;

	ll j=1;
	ll t=1;
	if(tstr[0]=='w')t += b;

	for(ll i=1;i<n;i++)str[j++]=tstr[i];
	for(ll i=0;i<n;i++)str[j++]=tstr[i] ;
	str[j]='\0';

	ll lptr=n;
	ll rptr=n;
	ll cptr=n;
	ll nop=1;
	if(t>T)nop=0;
	if(t==T)nop=1;

	while(t<T)
	{
		if(rptr-lptr==n-1)break;
//		if(t==T)break;
		if(lptr==1)
		{
			ll rtemp=a+1;
			if(str[rptr+1]=='w') rtemp +=b;
			cptr=rptr+1;rptr++; t+= rtemp;

		}
		else if(rptr==n)
		{
			ll ltemp=a+1;
			if(str[lptr-1]=='w')ltemp +=b;
			cptr=lptr-1 ;lptr-- ; t+=ltemp;
		}
		else if(cptr==rptr)
		{

			ll rtemp=a+1;
			ll ltemp=(rptr-lptr+1)*a +1 ;
			if(str[cptr+1]=='w')rtemp +=b;
			if(str[lptr-1]=='w')ltemp +=b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		else if(cptr==lptr)
		{
			ll ltemp=a+1;
			ll rtemp=(rptr-lptr+1)*a + 1 ;
			if(str[cptr-1]=='w')ltemp += b;
			if(str[rptr+1]=='w') rtemp += b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		if(t<=T) nop++ ;

	}
	p(nop);

}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define pb push_back
#define mx 1000005
char str[mx];
int main()
{
	ll n,a,b,T;
	s2(n,a);
	s2(b,T);

	string tstr;
	cin>>tstr;

	ll j=1;
	ll t=1;
	if(tstr[0]=='w')t += b;

	for(ll i=1;i<n;i++)str[j++]=tstr[i];
	for(ll i=0;i<n;i++)str[j++]=tstr[i] ;
	str[j]='\0';

	ll lptr=n;
	ll rptr=n;
	ll cptr=n;
	ll nop=1;
	if(t>T)nop=0;
	if(t==T)nop=1;

	while(t<T)
	{
		if((rptr-lptr) == (n-1))break;
//		if(t==T)break;
		if(lptr==1)
		{
			ll rtemp=a+1;
			if(str[rptr+1]=='w') rtemp +=b;
			cptr=rptr+1;rptr++; t+= rtemp;

		}
		else if(rptr==(n+n-1))
		{
			ll ltemp=a+1;
			if(str[lptr-1]=='w')ltemp +=b;
			cptr=lptr-1 ;lptr-- ; t+=ltemp;
		}
		else if(cptr==rptr)
		{

			ll rtemp=a+1;
			ll ltemp=(rptr-lptr+1)*a +1 ;
			if(str[cptr+1]=='w')rtemp +=b;
			if(str[lptr-1]=='w')ltemp +=b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		else if(cptr==lptr)
		{
			ll ltemp=a+1;
			ll rtemp=(rptr-lptr+1)*a + 1 ;
			if(str[cptr-1]=='w')ltemp += b;
			if(str[rptr+1]=='w') rtemp += b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}

	 nop++ ;

	}
	p(nop);

}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define pb push_back
#define mx 1000005
char str[mx];
int main()
{
	ll n,a,b,T;
	s2(n,a);
	s2(b,T);

	string tstr;
	cin>>tstr;

	ll j=1;
	ll t=1;
	if(tstr[0]=='w')t += b;

	for(ll i=1;i<n;i++)str[j++]=tstr[i];
	for(ll i=0;i<n;i++)str[j++]=tstr[i] ;
	str[j]='\0';

	ll lptr=n;
	ll rptr=n;
	ll cptr=n;
	ll nop=1;
	if(t>T)nop=0;
	if(t==T)nop=1;

	while(t<=T)
	{
		if((rptr-lptr) == (n-1))break;
//		if(t==T)break;
		if(lptr==1)
		{
			ll rtemp=a+1;
			if(str[rptr+1]=='w') rtemp +=b;
			cptr=rptr+1;rptr++; t+= rtemp;

		}
		else if(rptr==(n+n-1))
		{
			ll ltemp=a+1;
			if(str[lptr-1]=='w')ltemp +=b;
			cptr=lptr-1 ;lptr-- ; t+=ltemp;
		}
		else if(cptr==rptr)
		{

			ll rtemp=a+1;
			ll ltemp=(rptr-lptr+1)*a +1 ;
			if(str[cptr+1]=='w')rtemp +=b;
			if(str[lptr-1]=='w')ltemp +=b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		else if(cptr==lptr)
		{
			ll ltemp=a+1;
			ll rtemp=(rptr-lptr+1)*a + 1 ;
			if(str[cptr-1]=='w')ltemp += b;
			if(str[rptr+1]=='w') rtemp += b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}

		if(t<=T) nop++ ;

	}
	p(nop);

}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define pb push_back
#define mx 1000005
char str[mx];
int main()
{
	ll n,a,b,T;
	s2(n,a);
	s2(b,T);

	string tstr;
	cin>>tstr;

	ll j=1;
	ll t=1;
	if(tstr[0]=='w')t += b;

	for(ll i=1;i<n;i++)str[j++]=tstr[i];
	for(ll i=0;i<n;i++)str[j++]=tstr[i] ;
	str[j]='\0';

	ll lptr=n;
	ll rptr=n;
	ll cptr=n;
	ll nop=1;
	if(t>T)nop=0;
	if(t==T)nop=1;

	while(t<T)
	{
		if((rptr-lptr) == (n-1))break;
//		if(t==T)break;
//		if(lptr==1)
//		{
//			ll rtemp=a+1;
//			if(str[rptr+1]=='w') rtemp +=b;
//			cptr=rptr+1;rptr++; t+= rtemp;
//
//		}
//		else if(rptr==(n+n-1))
//		{
//			ll ltemp=a+1;
//			if(str[lptr-1]=='w')ltemp +=b;
//			cptr=lptr-1 ;lptr-- ; t+=ltemp;
//		}
		if(cptr==rptr)
		{

			ll rtemp=a+1;
			ll ltemp=(rptr-lptr+1)*a +1 ;
			if(str[cptr+1]=='w')rtemp +=b;
			if(str[lptr-1]=='w')ltemp +=b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		else if(cptr==lptr)
		{
			ll ltemp=a+1;
			ll rtemp=(rptr-lptr+1)*a + 1 ;
			if(str[cptr-1]=='w')ltemp += b;
			if(str[rptr+1]=='w') rtemp += b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}

		if(t<=T)nop++ ;

	}
	p(nop);

}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define pb push_back
#define mx 1000005
char str[mx];
int main()
{
	ll n,a,b,T;
	s2(n,a);
	s2(b,T);

	string tstr;
	cin>>tstr;

	ll j=1;
	ll t=1;
	if(tstr[0]=='w')t += b;

	for(ll i=1;i<n;i++)str[j++]=tstr[i];
	for(ll i=0;i<n;i++)str[j++]=tstr[i] ;
	str[j]='\0';

	ll lptr=n;
	ll rptr=n;
	ll cptr=n;
	ll nop=1;
	if(t>T)nop=0;
	if(t==T)nop=1;

	while(t<T)
	{
		if(rptr-lptr==n-1)break;
//		if(t==T)break;
		if(lptr==1)
		{
			ll rtemp=a+1;
			if(str[rptr+1]=='w') rtemp +=b;
			cptr=rptr+1;rptr++; t+= rtemp;

		}
		else if(rptr==n)
		{
			ll ltemp=a+1;
			if(str[lptr-1]=='w')ltemp +=b;
			cptr=lptr-1 ;lptr-- ; t+=ltemp;
		}
		else if(cptr==rptr)
		{

			ll rtemp=a+1;
			ll ltemp=(rptr-lptr+1)*a +1 ;
			if(str[cptr+1]=='w')rtemp +=b;
			if(str[lptr-1]=='w')ltemp +=b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		else if(cptr==lptr)
		{
			ll ltemp=a+1;
			ll rtemp=(rptr-lptr+1)*a + 1 ;
			if(str[cptr-1]=='w')ltemp += b;
			if(str[rptr+1]=='w') rtemp += b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		nop++ ;
	}
	p(nop);

}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define pb push_back
#define mx 1000005
char str[mx];
int main()
{
	ll n,a,b,T;
	s2(n,a);
	s2(b,T);

	string tstr;
	cin>>tstr;

	ll j=1;
	ll t=1;
	if(tstr[0]=='w')t += b;

	for(ll i=1;i<n;i++)str[j++]=tstr[i];
	for(ll i=0;i<n;i++)str[j++]=tstr[i] ;
	str[j]='\0';

	ll lptr=n;
	ll rptr=n;
	ll cptr=n;
	ll nop=1;
	if(t>T)nop=0;
	if(t==T)nop=1;

	while(t<T)
	{
		if((rptr-lptr) == (n-1))break;
//		if(t==T)break;
		if(lptr==1)
		{
			ll rtemp=a+1;
			if(str[rptr+1]=='w') rtemp +=b;
			cptr=rptr+1;rptr++; t+= rtemp;

		}
		else if(rptr==(n+n-1))
		{
			ll ltemp=a+1;
			if(str[lptr-1]=='w')ltemp +=b;
			cptr=lptr-1 ;lptr-- ; t+=ltemp;
		}
		else if(cptr==rptr)
		{

			ll rtemp=a+1;
			ll ltemp=(rptr-lptr+1)*a +1 ;
			if(str[cptr+1]=='w')rtemp +=b;
			if(str[lptr-1]=='w')ltemp +=b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}
		else if(cptr==lptr)
		{
			ll ltemp=a+1;
			ll rtemp=(rptr-lptr+1)*a + 1 ;
			if(str[cptr-1]=='w')ltemp += b;
			if(str[rptr+1]=='w') rtemp += b;
			if(rtemp<=ltemp){ cptr=rptr+1; rptr++ ; }
			else { cptr=lptr-1; lptr-- ;}

			t += min(rtemp,ltemp) ;
		}

		if(t<=T) nop++ ;

	}
	p(nop);

}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)

#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define fori(i,max) for(ll i=0;i<(ll)(max) ;(i)++)
#define for2i(i,min,max) for(ll i=min;i<(ll)(max) ;(i)++)

#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define plb pair<ll,bool>
#define pb push_back
#define mx 500090

ll rt[mx+5];
ll lt[mx+5];

int main()
{
	ll n,a,b,t;
	cin>>n>>a>>b>>t;
	string st;
	cin>>st;
	st=' '+st;

	for(ll i=2;i<=n;i++)
		rt[i]=rt[i-1]+a+1+b*(st[i]=='w');

	for(ll i=n;i>=2;i--)
		lt[i]=lt[i+1]+a+1+b*(st[i]=='w');

	t -= 1+b*(st[1]=='w');

	ll ans=0;

	for(ll i=1,j=2;i<=n;i++)
	 {
		if(rt[i]>t)break;

		while(j<=n && rt[i]+lt[j]+(i-1)*a > t)j++ ;

		ans=max(ans,i+n-j+1);
	 }

	 for(ll i=n+1,j=n;i>=2;i--)
	 {
	 	if(lt[i]>t)break;

	 	while(j>=1 && lt[i]+rt[j]+(n-i+1)*a > t)j-- ;

		ans=max(ans,n-i+1+j);
	 }
	 cout<<min(ans,n)<<endl;
}


//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
const int iinf = 0x7fffffff;
const ll linf = ~(1LL<<63);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;
template<typename T>
inline T gcd(T a, T b) {
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a%b);
}
template<typename C> // container
inline void sort(C& v) {
	sort(v.begin(), v.end());
}
inline void println(int u) { printf("%d\n", u); }
inline void printsp(int u) { printf("%d ", u); }

// -------------------- Spliters ------------------------
const int maxn = 5e5+10;
//不检查ll是猪!!!

int minus1(int x, int n) {
	if(x == 0) return n - 1;
	return x - 1;
}
int add1(int x, int n) {
	if(x == n - 1) return 0;
	return x + 1;
}

char st[maxn];
int sum[maxn];
ll bi_find(int l, int r, ll dis, ll fix, int a, int T) {
	ll ans = 0;
	while(l <= r) {
		ll mid = l + r >> 1;
		if((ll)fix + sum[mid] + 2 * min(dis, mid) * a + max(dis, mid) * a + mid <= T) {
			ans = max(ans, dis + 1 + mid);
			l = mid + 1;
		}
		else {
			r = mid - 1;
		}
	}
	return ans;

}
int main()
{
	ios::sync_with_stdio(0);
	int n, a, b;
	ll T;
	cin>>n>>a>>b>>T;
	cin>>st;
	ll time = 1 + (st[0] == 'w' ? b : 0);
	if(time > T) {
		cout<<0<<endl;
		return 0;
	}
	if(n == 1) {
		cout<<1<<endl;
		return 0;
	}
	for(int i = 1; i < n; i++) {
		sum[i] = sum[i - 1] + (st[i] == 'w' ? b : 0);
	}
	ll ans = max(1LL, bi_find(1, n - 1, 0, time, a, T));
	ll watch_time = time;
	for(int curr = n - 1; curr >= 1; curr--) {
		curr = minus1(curr, n);
		time += 1 + (st[curr] == 'w' ? b : 0);
		ans = max(ans, bi_find(1, curr - 1, n - curr, time, a, T));
		// find position between [1, curr - 1]
	}
	cout<<ans<<endl;

	return 0;
}
//--USE C++11