求出5个字符串中最长的字符串。每个字符串长度在100以内,且全为小写字母。
样例输入
one two three four five
样例输出
three
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int main()
{
string s[5];
// cin >> s[0] >> s[1] >> s[2] >> s[3] >> s[4];
int Max=0, MAX, i = 0;
for(i=0; i<5; i++)
{
cin >> s[i];
// cout << s[i].length();
if(s[i].length() > Max)
{ MAX = i;
Max = s[i].length();
}
// cout << Max;
}
cout << s[MAX] << endl;
return 0;
}