Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <set>
- #include <string>
- #include <numeric>
- #include <iostream>
- using namespace std;
- string AddStopWords(const string& query, const set<string>& stop_words) {
- return accumulate(stop_words.begin(), stop_words.end(), query, [](const string& result, const string& words) {
- return result + " -" + words;
- });
- }
- int main() {
- // Пример использования функции AddStopWords
- set<string> stop_words = {};
- string query = "some tasty oranges";
- string result = AddStopWords(query, stop_words);
- cout << result << endl; // Вывод: "Thisisthequery"
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement