S = input() nc = S.count('c') nw = S.count('w') print(min(nc - 1, nw))