#include int main(void){ char S[100001]; // words 'c' and 'd' int countC = 0; // numbers of 'c' int countW = 0; // numbers of 'w' scanf("%s",S); for(int i = 0; S[i] != 'w'; i++){ countC++; } for(int j = countC; S[j] != 0; j++){ countW++; } // check ok // printf("c = %d, w = %d\n",countC,countW); countC -= 1; if(countC <= countW){ printf("%d\n",countC); }else{ printf("%d\n",countW); } return 0; }