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