S = input() C = S.count("c") W = S.count("w") if C < W+1: print(C-1) else: print(W)