#include int main(int argc, char const *argv[]) { /* code */ char str[256]; int wp = 0; int flag = 0, cnt = 0; while(fscanf(stdin, "%c", &str[wp++]) != EOF){ if(str[wp - 1] == 'c'){ while(fscanf(stdin, "%c", &str[wp++]) != EOF){ cnt++; if(str[wp - 1] == 'w'){ while(fscanf(stdin, "%c", &str[wp++]) != EOF){ cnt++; if(str[wp - 1] == 'w'){ cnt++; flag = 1; break; } } if(flag == 1) break; }else if(str[wp - 1] == 'c'){ cnt = 0; } } if(flag == 1) break; } } if(flag == 1){ fprintf(stdout, "%d\n", cnt); }else{ fprintf(stdout, "-1\n"); } return 0; }