S = gets.chomp ans = [S.count('c')-1, S.count('w')].min puts ans