fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. int main() {
  5. std::string in, out;
  6. std::cin >> in;
  7. for (size_t i = 0; i < in.size()-1; ++i) {
  8. if (in[i] == '\\' and in[i+1] == 'n') {
  9. out += '\n';
  10. i++;
  11. } else {
  12. out += in[i];
  13. }
  14. }
  15. std::cout << out;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3476KB
stdin
Hello\nWorld!\n  
stdout
Hello
World!