方法一 使用stringstream方法 逐个单词输出
#include<iostream>
#include<sstream>
using namespace std;
int main(){
string s;
getline(cin,s);
stringstream ssin(s);
int cnt = 0;
string a;
string temp;
while(ssin >> temp){ //使用普通的cin也是可以的
if(temp[temp.size()-1] == '.'){
temp.pop_back();
}
if(temp.size() > cnt)
{cnt = temp.size();
a = temp;
}
}
cout<< a << endl;
return 0;
}