Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
68893 李琥博 31单词的长度 C++ Compile Error 0 MS 0 KB 414 2024-03-27 21:39:53

Tests(0/0):


Code:

#include<bits/stdc++.h> #include<cstring> using namespace std; int main(){ string s; getline(cin,s); int n=length(s),a=0; for(int i=0;i<n;i++){ if(s[i]==' '){ while(s[i+1]==' '){ i++; } cout<<n<<","; n=0; }else{ a++; } } cout<<n; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:16: error: 'length' was not declared in this scope
  int n=length(s),a=0;
                ^
Main.cc:16:20: error: 'a' was not declared in this scope
                    a++;
                    ^