S=list(input()) c=0 i=0 while S[i]=="c": c+=1 i+=1 S.reverse() w=0 i=0 while S[i]=="w": w+=1 i+=1 if w>c-1: print(c-1) else: print(w)