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 val sum = Array.fill(s.length + 1)(0) for (i <- s.length-1 to 0 by -1) { val x = if (s(i) == 'w') 1 else 0 sum(i) = sum(i+1) + x } var ans = 0L for (i <- 0 to s.length-1 if s(i) == 'c') ans += nck(sum(i), 2) println(ans) } }