fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <iterator>
  4. #include <sstream>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. const auto input = "Peas&Carrots Spinach-Casserole Beets Pizza Spinach-Salad Coleslaw"s;
  11. istringstream stream{ input };
  12.  
  13. copy_if(istream_iterator<string>(stream), istream_iterator<string>(), ostream_iterator<string>(cout, "\n"), [](const auto& i) { return i.find("Spinach") == string::npos; });
  14. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Peas&Carrots
Beets
Pizza
Coleslaw