{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "cf33ebb0691d42fc8d960a6b825d8c3e",
  "keywords": "算法高阶,字符串匹配,算法问题选编,利用有限自动机进行字符串匹配",
  "title": "结合两个字符串",
  "desc": [
    {
      "content": "\n写一个结合两个字符串的方法，从第一个字符串中取出一个字符，然后从第二个字符串中取出一个字符，以此类推。一旦一个字符串没有字符，它就应该继续使用另一个字符串\n输入：两个字符串，如s1=\"day\"和s2=\"time\"\n输出：一个结果字符串，对于上面的输入情况，它将是“dtaiyme”。",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <iostream>\n#include <string>\nusing namespace std;\nstring StrCon(const string& a, const string& b)\n{\n\tstring c;\n\tint n = a.size(), m = b.size();\n\tif (0 == n)\treturn a;\n\tif (0 == m) return b;\n\tint i, j;\n\tfor (i = 0, j = 0; i < n && j < m; ++i, ++j)\n\t{\n\t\tc += a[i];\n\t\tc += b[i];\n\t}\n\twhile (i < n)\n\t\tc += a[i++];\n\twhile (j < m)\n\t\tc += b[j++];\n\treturn c;\n}\nint main()\n{\n\tstring s = \"day\", t = \"time\";\n\tcout << StrCon(s, t) << endl;\n\tsystem(\"pause\");\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-7798b34864d141ac9f37b317b0907ceb",
  "license": "csdn.net",
  "created_at": 1637894159,
  "topic_link": "https://bbs.csdn.net/topics/600469844"
}