#include <iostream>
#include <iomanip>
#include <set>
#include <algorithm>
#include <iterator>
using namespace std;
set<int>& operator<<(set<int>& s, int x){
s.insert(x); return s;
}
int main(){
set<int> a, b;
a << 1 << 3 << 4 << 5;
b << 2 << 3 << 4 << 6;
cout << "set 1: ";
copy(a.begin(), a.end(), ostream_iterator<int>(cout, " "));
cout << "\n";
cout << "set 2: ";
copy(b.begin(), b.end(), ostream_iterator<int>(cout, " "));
cout << "\n";
cout << "intersection: ";
set_intersection(a.begin(), a.end(), b.begin(), b.end(),
ostream_iterator<int>(cout, " "));
cout << "\n";
cout << "difference: ";
set_difference(a.begin(), a.end(), b.begin(), b.end(),
ostream_iterator<int>(cout, " "));
cout << "\n";
cout << "union: ";
set_union(a.begin(), a.end(), b.begin(), b.end(),
ostream_iterator<int>(cout, " "));
cout << "\n";
}