We have that code: 

#include <iostream>
#include <string>
#include <vector> 

using namespace std;

int main() {
    vector<string> words;
    string query;
    getline(cin, query);
    string word;
    for (char c : query) {
        if (c == ' ') {
            words.push_back(word);
            word = ""s;
        } else {
            word += c;
        }
    }
    words.push_back(word);
    for (string word : words) {
    cout << '[' << word << ']' << endl;
} 
}

How we can ignore spaces in cin and not cout them?