#10万ぐらいいけるやろ・・・ s = gets.chomp count = 0 for i in 0..(s.length-3) do next unless s[i] == "c" for j in (i+1)..(s.length-2) do next unless s[j] == "w" for k in (j+1)..(s.length-1) do next unless s[k] == "w" count += 1 end end end puts count