第五章26
【题目描述】
键盘输入一段英文,输出其中的单词个数。
【输入】
一段英文单词
【输出】
单词的个数
【样例输入】
I love China and the people↙
【样例输出】
6
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int a=1,c; while((c=getchar())!='\n') { if(c==' ') a=a+1; } printf("%d",a); return 0; }
风过林梢,骄阳正好
彼时他们正当年少。