S=raw_input() w=S.count('w') L=len(S) print min(L-w-1,w)