Run ID:82454

提交时间:2024-07-13 11:28:34

#include <bits/stdc++.h> using namespace std; int main() { int m = 0, c = 0; string b; getline(cin, b); int l = b.length(); for (int i = 0; i < l; i++) { if (b[i] != ' ') { m++; } else { if (m > 0) { c++; } m = 0; } } if (m > 0) { cout << c + 1; } else { cout << c; } return 0; }