统计单词 题解:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
while (getline(cin, str))
{
int count = 0;
for (int i = 0; i < str.size()&&str[i]!='.'; i++)
{
if (str[i] != ' ') count++;
else
{
if(count!=0) cout << count << " ";
count = 0;
}
}
 ...
登录后发布评论
暂无评论,来抢沙发