import sys input=lambda: sys.stdin.readline().rstrip() S=input() c=S.count("c") w=S.count("w") print(min(c-1,w))