s = input() c_cnt = s.count("c") w_cnt = s.count("w") print(max(min(c_cnt - 1, w_cnt), 0))