[code=C++]#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <string>
#include <algorithm>
#include <iterator>
#define is_latin(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
void output_rev(std::ostream& _out, const std::string& s);
void output_unique(std::ostream& _out, const std::string& s);
void output_sort(std::ostream& _out, const std::string& s);
void output_sym(std::ostream& _out, const std::string& s);
struct pword {
std::string::const_iterator a, b;
pword(void) { }
pword(std::string::const_iterator _a, std::string::const_iterator _b):a(_a), b(_b) { }
bool operator < (const pword& w) const {
return std::lexicographical_compare(a, b, w.a, w.b);
}
};
int main(void) {
std::ifstream fp("file.txt");
if(!fp.is_open())
return 1;
std::ostringstream sout;
std::copy(std::istreambuf_iterator<char>(fp), std::istreambuf_iterator<char>(),
std::ostreambuf_iterator<char>(sout));
fp.close();
const std::string& s = sout.str();
//початкова стрічка
std::cout << s << std::endl;
//а).
output_rev(std::cout, s);
std::cout << std::endl;
//б).
output_unique(std::cout, s);
std::cout << std::endl;
//в).
output_sort(std::cout, s);
std::cout << std::endl;
//г).
output_sym(std::cout, s);
std::cin.get();
[/code]