Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
117092 | 彭士宝 | 单词的长度 | Python3 | Compile Error | 0 MS | 0 KB | 608 | 2025-04-13 16:38:54 |
#include <iostream> #include <sstream> #include <vector> using namespace std; int main() { string input; getline(cin, input); // 读取整行输入 istringstream iss(input); vector<int> wordLengths; string word; // 使用字符串流分割单词 while (iss >> word) { wordLengths.push_back(word.length()); } // 输出单词长度,用逗号分隔 for (size_t i = 0; i < wordLengths.size(); ++i) { cout << wordLengths[i]; if (i < wordLengths.size() - 1) { cout << ","; } } return 0; }
File "Main.py", line 4 using namespace std; ^ SyntaxError: invalid syntax