Filipbg

CensorshipMain.cpp

Jan 18th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <set>
  5.  
  6. #include "Article13Filter.h"
  7.  
  8. int main() {
  9.     std::string copyrightedLine;
  10.     std::getline(std::cin, copyrightedLine);
  11.  
  12.     std::set<std::string> copyrighted;
  13.     std::istringstream lineIn(copyrightedLine);
  14.     std::string copyrightedItem;
  15.     while (lineIn >> copyrightedItem) {
  16.         copyrighted.insert(copyrightedItem);
  17.     }
  18.  
  19.     Article13Filter filter(copyrighted);
  20.  
  21.     std::string inputLine;
  22.     while (std::getline(std::cin, inputLine) && inputLine != "end") {
  23.         if (!filter.blockIfCopyrighted(inputLine)) {
  24.             std::cout << inputLine;
  25.         }
  26.     }
  27.  
  28.     std::cout << "Blocked: ";
  29.     for (std::string blockedItem : filter.getBlocked()) {
  30.         std::cout << blockedItem << " ";
  31.     }
  32.  
  33.     return 0;
  34. }
Add Comment
Please, Sign In to add comment