A = raw_input() print max(min(A.count('c')-1, A.count('w')), 0)