您的位置:首页 > 其它

water || 算英文句子中单词个数

2018-03-27 23:07 246 查看
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
char c[5000000];
int ans;
bool isapha(char x){
if((x>='a'&&x<='z')||(x>='A'&&x<='Z'))return true;
else return false;
}
int main(){
while(cin.getline(c,5000000)){
ans=0;
bool f=0;
for(int i=0;i<strlen(c);i++){
if(isapha(c[i])&&f==0){
ans++;
f=1;
}
else if(!isapha(c[i])){
f=0;
}
}
cout<<ans<<endl;
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐