#include <stdio.h> int main(){ char c; char pre_c=' '; int count=0; while (scanf("%c",&c)!=EOF && c!='\n'){ // printf("c=%c\n",c); if (pre_c!=' ' && c==' '){count++;} pre_c = c; } if (pre_c!=' ' && c=='\n'){count++;} if (pre_c!=' ' && c==' '){count++;} printf("%d",count); return 0; }