#include #include #include #include using namespace std; using ll = long long int; using P = pair; constexpr ll INF = 1LL<<50; int main() { int n; string s; cin >> n >> s; vector a(n+1), cnt(n+1); for(int i=0;i> a[i+1]; a[i+1] += a[i]; if(s[i] == 'E') cnt[i+1]++; cnt[i+1] += cnt[i]; } int q; cin >> q; for(int i=0;i> k; int l=0, r=0; while(r k){ l++; } while(r<=n && a[r]-a[l] <= k){ ans = max(ans, cnt[r]-cnt[l]); r++; } } cout << ans << endl; } return 0; }