法一:
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int main()
{
string s;
getline(cin, s);
stringstream ssin(s);
string w;
string l;
int m=0;
while(ssin>>w)
{
if(w.back()==’.’)
w.pop_back();
if(w.size()>m)
{
m=w.size();//不要用strlen
l=w;
}
}
cout<<l<<endl;
return 0;
}
法二:
include[HTML_REMOVED]
using namespace std;
int main()
{
string r,s;
while(cin>>s)
{
if(s.back() == ‘.’)
s.pop_back();
if(s.size()>r.size())
r=s;
}
cout<<r<<endl;
return 0;
}