Untitled
unknown
c_cpp
3 years ago
319 B
6
Indexable
#include <iostream>
using namespace std;
int main(void) {
string i;
while (getline(cin, i)) {
int space = 0;
for (int j = 0; j < i.size(); j++) {
if (i[j] == ' ' && (j == 0 || i[j - 1] != ' ')) space++;
}
cout << space + 1 << endl;
}
return 0;
}Editor is loading...