s = input() print( min( max( 1, s.count('c'))-1 , max(2,s.count('w'))-2))