def main(): s=input() w=s.count("w") c=s.count("c") ans=min(w,c-1) print(ans) if __name__=="__main__": main()