S = input() c,w = S.count("c"),S.count("w") print(w if c-1 >= w else c-1)