break input stream into words
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
int main() {
std::string input;
std::cout << "Enter a sentence: ";
std::getline(std::cin, input);
std::istringstream iss(input);
std::vector<std::string> words;
do {
std::string word;
iss >> word;
words.push_back(word);
} while (iss);
std::cout << "Words in the input sentence:\n";
for (const auto& word : words) {
if (!word.empty()) {
std::cout << word << "\n";
}
}
return 0;
}