#include <iostream>
#include <string>
#include <sstream>
using namespace std;
signed main() {
string s;
getline(cin, s);
cout << distance(istream_iterator<string>(istringstream(s) >> ws), istream_iterator<string>());
return 0;
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
signed main() {
string s;
getline(cin, s);
cout << distance(istream_iterator<string>(istringstream(s) >> ws), istream_iterator<string>());
return 0;
}