char s[99];i,m,t;main(j){for(gets(s);s[j=i];j-=i++-2,!t&(!m|m>j)?m=j:0)for(t=2;s[i]==99&&t&&s[++j];t-=s[j]=='w');i=!printf("%d",m-1);}