import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] c = sc.next().toCharArray(); long[] wCnts = new long[c.length]; if(c[c.length - 1] == 'w'){ wCnts[wCnts.length - 1] = 1; } long sum = 0l; for (int i=c.length - 2; i>=0; i--) { if(c[i] == 'w'){ wCnts[i] = wCnts[i+1] + 1; }else if(c[i] == 'c'){ long wCnt = wCnts[i+1]; sum += (wCnt * (wCnt - 1)) / 2; wCnts[i] = wCnts[i+1]; }else{ wCnts[i] = wCnts[i+1]; } } System.out.println(sum); } }