#include "string_processing.h" #include using namespace std; vector SplitIntoWords(const string &text) { vector words; string word; std::istringstream iss(text, std::istringstream::in); while(iss >> word) { words.push_back(word); } return words; } vector SplitIntoWordsView(string_view str) { vector result; const int64_t pos_end = static_cast(str.npos); while (true) { int64_t space = static_cast(str.find(' ')); string_view s = str.substr(0, static_cast(space)); if (!s.empty()) { result.push_back(s); } if (space == pos_end) { break; } else { str.remove_prefix(static_cast(space+1)); } } return result; }