A = raw_input() print max(A.count('c')-2, A.count('w')-3, 0)