不是VIP会员,不能显示答案

题目解答

题目:
#include <iostream> 
#include <string>
using namespace std;
int main() { 
   int len, maxlen;
    string s, ss;
    maxlen = 0;
    do { 
       cin >> ss; 
       len = ss.length();
        if (ss[0] == '# ')
            break; 
       if (len > maxlen) {
            s = ss; 
           maxlen = len;
        } 
   } while (true);
    cout << s << endl;
    return 0;
}
输入:
I
am
a
citizen     
of     
China
#
输出:citizen
考点: 0
分析:
解答: 很容易看出程序输出的是输入数据中长度最长的字符串,故答案是citizen。
评论:
老师: 0