#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
char str[100];
gets(str);
int numbers = 0;
int flag =0;//用来标记 如果是第一个字母
for(int i=0;str[i]!='\0';i++){
//cout<<str[i];
if(str[i] != ' ' && flag == 0){
flag = 1;//为了编辑不是空格后第一个字母
numbers++;
}
else if(str[i] == ' '){
flag = 0;//flag=0;等待下一个空格之后的字母
}
}
cout<<numbers;
return 0;
}
58_单词统计
猜你喜欢
转载自blog.csdn.net/qq_41440031/article/details/104071666
今日推荐
周排行