fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. string s = "ABCDEFGHIJK";
  8.  
  9. for(size_t i = 0; i + 3 < s.length(); i += 3)
  10. {
  11. s[i] ^= s[i + 2];
  12. s[i + 2] ^= s[i];
  13. s[i] ^= s[i + 2];
  14. }
  15.  
  16. cout << s << endl;
  17. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
CBAFEDIHGJK