#include<stdio.h>
int main()
{
int i,j,word=0,flag=0;
char ch;
while((ch=getchar())!='\n')
{
if(ch!=' '&&flag==0)
word++;
if(ch==' '){
flag=0;
}
if(ch!=' ')
flag=1;
}
printf("一共有%d",word);
return 0;
}
统计输入字符串单词个数
最新推荐文章于 2022-12-20 10:07:28 发布