#include #include int combi(int c) { if( c < 2 ) return 0; return c*(c-1)/2; } int main(void) { int i, j, sum = 0; char s[100001] = {'\0'}, a[100001]; scanf("%s", &a); for( i = 0; a[i] != NULL; i++) { if( a[i] == 'w' ) { strcat(s, "w"); } else if ( a[i] == 'c' ) { strcat(s, "c"); } } for( i = 0; s[i] != NULL; i++) { if( s[i] == 'c' ) { int wc = 0; for( j = i+1; s[j] != NULL; j++) { if( s[j] == 'w' ) wc++; } sum += combi(wc); } } printf("%d\n", sum); return 0; }