S = input() ans = min(S.count("c") - 1,S.count("w")) print(ans)