nord vpnnord vpn
Ad

Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
319 B
2
Indexable
Never
#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;
}

nord vpnnord vpn
Ad