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