S = input().strip()

n_c = 0
for c in S:
    if c == 'c':
        n_c += 1
    else:
        break  # since the input is guaranteed to start with c's followed by w's
n_w = len(S) - n_c

print(min(n_c - 1, n_w))