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 >m-w: print(m-w) else: print(c)