S=input() C=0 W=0 for i in range(len(S)): if S[i]=="c": C+=1 else: W+=1 print(min(C-1,W))