import java.util.*; class A{ static Scanner s = new Scanner(System.in); public static void main(String[] args) { String in = s.next().replaceAll("[^cw]", ""); int w=0, r=0; for(int i=in.length()-1; i>=0; --i) { if(in.charAt(i)=='w') { w++; }else { r+=w*(w-1)/2; } } System.out.println(r); } }