Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
117096 彭士宝 单词的长度 Python3 Compile Error 0 MS 0 KB 703 2025-04-13 16:44:13

Tests(0/0):


Code:

#include <iostream> #include <sstream> #include <vector> using namespace std; int main() { string input; // 读取一行输入 if (!getline(cin, input)) { cerr << "Error: Unable to read input." << endl; return 1; } 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; }


Run Info:

  File "Main.py", line 4
    using namespace std;
                  ^
SyntaxError: invalid syntax