import java.util.ArrayList; import java.util.Scanner; public class Chiwawa { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s = new Scanner(System.in); StringBuilder str = new StringBuilder(s.nextLine()); s.close(); long all = 0; ArrayList cp = new ArrayList<>(); ArrayList wp = new ArrayList<>(); for(int i = str.length()-1;i >= 0;i--){ if(str.charAt(i) == 'c'){ cp.add(0, i); }else if(str.charAt(i) == 'w'){ wp.add(0, i); } } int start = 0; for(int i:cp){ int count = 0; boolean tf = true; for(int j = start;j < wp.size();j++){ if(wp.get(j) > i){ count++; if(tf){ start = j; tf = false; } } if(count == 2){ count += (wp.size()-j-1); break; } } if(count <2){ break; }else{ all += Combination(count,2); } } System.out.println(all); } static long Combination(int r,int q){ long rCq = 1; for(int i = 1;i <= q;i++){ rCq = rCq * r-- / i; } return rCq; } }