用C++的string类
#include <iostream>
#include <string>
using namespace std;
int main()
{
string ss, ans;
int end = 0;
while (1)
{
cin >> ss;
if (ss[ss.length() - 1] == '.') end = 1;
int ss_len = ss.length();
if (end) ss_len -- ;
if (ss_len > ans.length()) ans = ss;
if (end) break;
}
for (int i = 0; i < ans.length(); i ++ )
{
if (ans[i] == '.' && i == ans.length() - 1) continue;
cout << ans[i];
}
return 0;
}