提交时间:2025-04-06 14:32:10

运行 ID: 316273

#include<bits/stdc++.h> using namespace std; int main(){ string s; int c=0; getline(cin,s); for(int i=0;i<s.size();i++){ if(s[i]==' '&&s[i+1]!=' '||i==0){ c++; } } cout<<c<<endl; }