func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5 * 100005;   int sum[N];   char str[5 * 100005];   int costf[5 * 100005];   int costb[5 * 100005];   int n, a, b, t;   int main() {     scanf( %d , &n);     scanf( %d , &a);     scanf( %d , &b);     scanf( %d , &t);     cin >> str;     if (str[0] ==  h )       costf[1] = 1;     else       costf[1] = 1 + b;     for (int i = 2; i <= n; i++) {       if (str[i - 1] ==  h )         costf[i] = (costf[i - 1] + 1 + a);       else         costf[i] = (costf[i - 1] + 1 + a + b);     }     if (str[n - 1] ==  h )       costb[n] = 1;     else       costb[n] = (1 + b);     for (int i = n - 1; i >= 1; i--) {       if (str[i - 1] ==  h )         costb[i] = (costb[i + 1] + 1 + a);       else         costb[i] = (costb[i + 1] + 1 + a + b);     }     vector<int> v;     for (int i = n; i >= 1; i--) {       v.push_back(costb[i]);     }     int ans = 0;     for (int i = 1; i <= n; i++) {       int x = t;       if (costf[i] > x) {         break;       } else {         int temp = 0;         temp += i;         x -= costf[i];         x -= (a * i);         if (x > 0) temp += (upper_bound(v.begin(), v.end(), x) - v.begin());         if (temp > n) temp = n;         ans = max(ans, temp);       }     }     vector<int> vv;     for (int i = 2; i <= n; i++) {       vv.push_back(costf[i] - a - costf[1]);     }     for (int i = n; i >= 1; i--) {       int x = t;       if (costb[i] + costf[1] + a > x)         break;       else {         int temp = 0;         temp += (n - i + 1);         temp += 1;         x -= (costb[i] + a + costf[1]);         x -= (n - i + 2) * a;         if (x > 0) temp += (upper_bound(vv.begin(), vv.end(), x) - vv.begin());         if (temp > n) temp = n;         ans = max(ans, temp);       }     }     cout << ans;     return 0;   }   