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