Praktikum_mf

Базовые алгоритмы/Алгоритм accumulate/Задание 2

Sep 30th, 2021
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. #include <string>
  5. #include <numeric>
  6.  
  7. using namespace std;
  8.  
  9. string FoldWithMinus(string left, string right) {
  10.     return left + " -"s + right;
  11. }
  12.  
  13. string AddStopWords(const string& query, const set<string>& stop_words) {
  14.     return query + std::accumulate(stop_words.begin(), stop_words.end(), ""s, FoldWithMinus);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment