Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
40472 奚晨瑞 最长单词 C++ Compile Error 0 MS 0 KB 331 2024-02-10 21:33:16

Tests(0/0):


#include<iostream> #include<cstring> using namespace std; char a[501],str[501]; 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); } } cout<<str; return 0; }


Judgement Protocol: