S = input().strip() c = S.count('c') w = S.count('w') print(min(max(c-1, 0), w))