#include #include #include #include using namespace std; using namespace atcoder; using namespace __gnu_pbds; using ll=long long; using ld=long double; using vll=vector; using vvll=vector; using pll=pair; // using mint=modint; // template // using ordered_map=tree,rb_tree_tag,tree_order_statistics_node_update>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string S; cin>>S; ll N=S.size(); vll pref(N,-1),suff(N,-1); for(int i=0;i0) pref[i]=pref[i-1]; } for(int i=N-1;i>=0;--i){ if(S[i]=='w')suff[i]=i; else if(i