Ответ:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string s;
int k=1;
getline(cin, s);
vector<string> words(1, "");
for (auto c: s)
if (c == ' ' || c==',' || c=='.'){
k++;
}
cout << k<< endl;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string s;
int k=1;
getline(cin, s);
vector<string> words(1, "");
for (auto c: s)
{
if (c == ' ' || c==',' || c=='.'){
k++;
}
}
cout << k<< endl;
return 0;
}