解题思路:具体看注释
注意事项:无
参考代码:
#include <stdio.h> #include <string.h> int main(){ char str1[100005], str2[100005]; int i, len = 0, maxn = -1; while (scanf("%s", str1) != EOF) { len = strlen(str1); //获取字符长度 if (maxn < len) { maxn = len; //更新最长长度 strcpy(str2, str1); //交换最长字符串 } } puts(str2); //输出结果 return 0; }
0.0分
0 人评分