s=gets.chomp.chars y=s.count{|c|c=='w'} a=0 s.map{|c|y-=1 if c=='w' a+=y*(y-1)/2 if c=='c'} p a