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