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

Tests(0/0):


Code:

#include<bits/stdc++.h> #include<cstring> using namespace std; int main() { string s; getline(cin,s); int n=strlen(s),a=0; for(int i=0;i<n;i++){ if(i!=' '){ a++; }else{ printf("%d,",a); a=0; } } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:16: error: cannot convert 'std::__cxx11::string {aka std::__cxx11::basic_string}' to 'const char*' for argument '1' to 'size_t strlen(const char*)'
  int n=strlen(s),a=0;
                ^
Main.cc:11:18: error: 'a' was not declared in this scope
                  a++;
                  ^
Main.cc:13:31: error: 'a' was not declared in this scope
                  printf("%d,",a);
                               ^