#include #include #include #include #include #include using namespace std; ostream& operator<<(ostream& out, const vector& v) { copy(v.cbegin(),v.cend(),ostream_iterator(out," ")); out << endl; return out; } char encode(char c) { bitset<8> ch(c); ch.flip(); return static_cast(ch.to_ulong()); } int main() { string str("HAVE A NICE DAY"); vector vc(str.size()); vector vc2(str.size()); copy(str.cbegin(),str.cend(),vc.begin()); cout << vc << endl; transform(vc.begin(),vc.end(),vc2.begin(),encode); cout << vc2 << endl; copy(vc2.begin(),vc2.end(),str.begin()); cout << str << endl; transform(vc2.begin(),vc2.end(),vc.begin(),encode); copy(vc.begin(),vc.end(),str.begin()); cout << str << endl; }