import math._ object Main { def nck(n: Long, k: Long): Long = { var nume = 1L var deno = 1L for (i <- 1L to k) { nume *= n - i + 1 deno *= i } nume / deno } def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val s = sc.next var w = 0 var ans = 0L for (i <- s.length-1 to 0 by -1) s(i) match { case 'w' => w += 1 case 'c' => ans += nck(w, 2) case _ => } println(ans) } }