题目
字符串可是比赛经常出的问题,那么给大家出一个题,
输入五个字符串,输出5个字符串当中最长的字符串。每个字符串长度在100以内,且全为小写字母。
输入
无
输出
无
样例输入
one two three four five
样例输出
three
代码
#include<stdio.h>
#include<string.h>
int main()
{
char temp[101],max[101];
int MAX = 0 ;
int len;
while (scanf("%s",temp)!=EOF){
len = strlen(temp);
if (len>MAX)
{
MAX = len;
strcpy(max,temp);
}
}
printf("%s",max);
return 0;
}