1 #include <stdio.h> 2 #include <string> 3 #include <iostream> 4 #include <fstream> 5 #include <iterator> 6 #include <vector> 7 #include <algorithm> 8 using namespace std; 9 ostream_iterator < string > oo(cout); 10 int main() 11 { 12 string from,to; 13 cin>>from>>to; 14 15 ifstream is(from.c_str()); 16 istream_iterator<string> ii(is); 17 istream_iterator<string> eos; 18 19 ofstream os(to.c_str()); 20 ostream_iterator<string> oi(os,"\n"); 21 22 vector<string> v(ii,eos); 23 sort(v.begin(),v.end()); 24 25 unique_copy(v.begin(),v.end(),oi); 26 27 return !is.eof()||!os; 28 29 30 31 }