Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3433 | 莫业祁 | 31单词的长度 | C++ | Compile Error | 0 MS | 0 KB | 304 | 2024-06-08 10:00:21 |
# include<iostream> using namespace std; int main(){ string s1; cin>>s1; int n=s1.size(); int s=0; for(int i=0;i<n;i++){ if(s1[i]==" "){ cout<<s; if(i!==n-1) cout<<","; s=0; } else s++; } return 0; }
Main.cc: In function 'int main()': Main.cc:10:19: warning: comparison with string literal results in unspecified behaviour [-Waddress] if(s1[i]==" "){ ^ Main.cc:10:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] Main.cc:12:15: error: expected primary-expression before '=' token if(i!==n-1) cout<","; ^