Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
40550 奚晨瑞 最长单词 C++ 解答错误 0 MS 240 KB 333 2024-02-12 22:27:34

Tests(0/3):


#include<iostream> #include<cstring> using namespace std; char a[502],str[502]; int main() { gets(a); int x = 0; int temp = 1; for(int i=0;i<=strlen(a)-2;i++){ if(a[i]!=' '&&a[i]!='.'){ temp++; } else{ temp=1; } if(temp>x){ strncpy(str,a+i+2-temp,temp-1); } } cout<<str; return 0; }


测评信息: