# coding: utf-8 S = input() c_count = S.count("c") w_count = S.count("w") print(min(c_count - 1, w_count))