L = list(input()) cw, cc = L.count('w'), L.count('c') if cw < cc: print(cw) else: print(cc-1)