Untitled

as
Anonymous
c_cpp
01/18/2024 5:24 PM
428 B
21
Indexable
#include <iostream>
#include <string>

using namespace std;

int main() {
    string input;
    getline(cin, input);

    int spaceCount = 0;
    for (char character : input) {
        if (character == ' ') {
            spaceCount++;
        }
    }


    cout << spaceCount << endl;

    return 0;
}
Editor is loading...
Leave a Comment