def min(a, b): return a if a <= b else b s = input() count_c = s.count('c') count_w = s.count('w') res = min(count_c - 1, count_w) print(res)