Untitled

mail@pastecode.io avatar
unknown
c_cpp
a month ago
281 B
0
Indexable
Never
#include <iostream>
#include <string>
using namespace std;
int main() 
{
    string str;
    getline(cin, str);
    int i = 0;
    for (char ch : str) 
    {
        if (ch == ' ') 
        {
            i++;
        }
    }
    cout  << i << endl;
    return 0;
}
Leave a Comment