S = input() C = S.count("c") W = S.count("w") print(min(C - 1, W))