#include <iostream> #include <sstream> #include <string> using namespace std; string xor_str(string, string); int main(){ \x09string input, line; \x09while (getline(cin, input)) { \x09\x09line = xor_str(line, input); \x09\x09cout << line << endl; \x09} \x09return 0; } string xor_str(string a, string b) { \x09string c = (a.size() > b.size() ? a : b); \x09for (int i = 0; i < (a.size() < b.size() ? a.size() : b.size()); i++) { \x09\x09c[i] = (char)((int)a.at(i) ^ (int)b.at(i)); \x09} \x09return c; }
Note that non-ascii characters in the above source code will be escaped (such as \x9f).