C++ 代码
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int main(){
string str;
getline(cin,str);
int len=0,index,max=0;
for(int i=0;i<str.size();i++){
if(str[i] != ' '&&str[i] != '.') len++;
else {
if(len>max){
max = len;
index = i - len;
}
len = 0;
}
}
while(str[index] != ' '&&str[index] != '.'){
cout<<str[index];
index++;
}
return 0;
}