#include <iostream>
#include <string>
#include <vector>
using namespace std;

const vector<string> kToPrint = {
  "#include <iostream>",
  "#include <string>",
  "#include <vector>",
  "using namespace std;",
  "",
  "const vector<string> kToPrint = {",
  "@",
  "};",
  "",
  "void printProgramInQuotes() {",
  "  for (string line: kToPrint) {",
  "    cout << \"  \\\"\";",
  "    for (char ch: line) {",
  "      if (ch == '\"') cout << \"\\\\\\\"\";",
  "      else if (ch == '\\\\') cout << \"\\\\\\\\\";",
  "      else cout << ch;",
  "    }",
  "    cout << \"\\\",\" << endl;",
  "  }",
  "}",
  "",
  "int main() {",
  "  for (string line: kToPrint) {",
  "    if (line == \"@\") printProgramInQuotes();",
  "    else cout << line << endl;",
  "  }",
  "}",
};

void printProgramInQuotes() {
  for (string line: kToPrint) {
    cout << "  \"";
    for (char ch: line) {
      if (ch == '"') cout << "\\\"";
      else if (ch == '\\') cout << "\\\\";
      else cout << ch;
    }
    cout << "\"," << endl;
  }
}

int main() {
  for (string line: kToPrint) {
    if (line == "@") printProgramInQuotes();
    else cout << line << endl;
  }
}
