Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155873 余建成 单词的长度 C++ Compile Error 0 MS 0 KB 291 2026-06-14 12:11:52

Tests(0/0):


Code:

#include<iostream> #include<cstring> using namespace std; int main(){ char a[1001]={}; int len,sum=0; cin.getline(a,1000); len=strlen(s); for(int i=0;i<strlen;i++){ if(a[i]!='')sum++; else{ if(sum>0) cout<<sum<<","; sum=0 } } cout<<sum<<endl; return 0; }


Run Info:

Main.cc:10:12: error: empty character constant
   if(a[i]!='')sum++;
            ^
Main.cc: In function 'int main()':
Main.cc:8:13: error: 's' was not declared in this scope
  len=strlen(s);
             ^
Main.cc:9:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  for(int i=0;i