s = gets.chomp h = Hash.new{|s,k| s[k] = []} for i in 0..(s.length-1) do case s[i] when "c" then h["c"] << i when "w" then h["w"] << i end end count = 0 h["c"].each do |i| ws = h["w"].select{|j| j > i}.size count += ws * (ws-1) / 2 end puts count