#include int num[100000]; main(){ int sum = 0; char c; int count = 0;//cの数 while((c=getchar())!='\n' && c!=' '){ if(c=='c'){ num[count] = sum; count++; } if(c=='w'){ sum++; } } long long ans = 0; for(int i = 0;i < count;i++){ int a = sum-num[i]; if(a >= 2){ ans += a*(a-1)/2; } } printf("%lld\n",ans); }