C++ 代码
#include <iostream>
using namespace std;
int main()
{
string str;
int count= 0;
int len[2]={0,0};
getline (cin,str);
for(int i=0;i<str.size();i++)
{
int st=i,end=i;
while(str[end] != ' ' && str[end] != '.') end++;
if((end - st) > count)
{
count = end - st;
len[0] = st;
len[1] = end;
}
//cout << st <<" " << end <<" "<<count<<endl;
i = end;
}
for(int i=len[0];i<len[1];i++)
cout << str[i];
return 0;
}