s=input() m=len(s) c=s.rfind("c") w=s.find("w") if s=="cww"or len(s)<3: print(0) else: if c +1>m-w-1: print(m-w-1) else: print(c+1)