fork(8) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. std::string Filter(const std::string &to, const std::string &remove)
  5. {
  6. std::string final;
  7. for(std::string::const_iterator it = to.begin(); it != to.end(); ++it)
  8. {
  9. if(remove.find(*it) == std::string::npos)
  10. {
  11. final += *it;
  12. }
  13. }
  14. return final;
  15. }
  16.  
  17. int main()
  18. {
  19. std::string s;
  20. std::cout << "Enter some text: " << std::endl;
  21. std::getline(std::cin, s);
  22. std::cout << Filter(s, "'\\,<\".<") << std::endl;
  23. }
Success #stdin #stdout 0.01s 2860KB
stdin
.Alpha, "Beta" \Gamma'
stdout
Enter some text: 
Alpha Beta Gamma