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