fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <functional>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. struct Slowa {
  9. string a;
  10. string b;
  11. };
  12.  
  13. class AEqual : public binary_function<Slowa, string, bool> {
  14. public:
  15. result_type operator()(const first_argument_type &lewy, const second_argument_type &prawy) const {
  16. return lewy.a==prawy;
  17. }
  18. };
  19.  
  20. int main() {
  21. vector<Slowa> v;
  22. string x;
  23. Slowa a;
  24. cin>>x;
  25. while (cin >>a.a>>a.b) {
  26. v.push_back(a);
  27. }
  28. vector<Slowa>::iterator i;
  29. i=remove_if(v.begin(), v.end(), bind2nd(AEqual(), x));
  30.  
  31. v.erase(i, v.end());
  32.  
  33. for(i=v.begin(); i!=v.end(); ++i) {
  34. cout << i->a << " " << i->b << endl;
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 2864KB
stdin
remove
ale ma
kota remove
remove pies
remove kon
dziecie ok
nic cos
remove zero
stdout
ale ma
kota remove
dziecie ok
nic cos