Run ID:133296
提交时间:2025-10-18 14:25:15
#include <iostream> #include <string> using namespace std; int main() { string s; getline(cin, s); int count = 0; bool inWord = false; for (int i = 0; i < s.length(); i++) { if (s[i] != ' ') { if (!inWord) { count++; inWord = true; } } else { inWord = false; } } cout << count << endl; return 0; }