统计单词 题解:
#include<iostream>
using namespace std;
char s[1010];
int main()
{
string str;
while(cin.getline(s,110))
{
int cnt=0;
for(int i=0;s[i]!='.';i++)
{
if(s[i]>='a'&&s[i]<='z')
{
cnt++;
if(s[i+1]==' '||s[i+1]=='.')
{
cout<<cnt<<" ";
cnt=0;
}
}
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发