s=input() c_count=s.count("c") w_count=s.count("w") if c_count<=w_count: print(c_count-1) else: print(w_count)