Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
82344 刘泽熙 31单词的长度 C++ Accepted 1 MS 280 KB 323 2024-07-13 10:54:50

Tests(5/5):


Code:

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