{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "a691200feb064addb5299c796864fb54",
  "keywords": "算法高阶,字符串匹配,算法问题选编,利用有限自动机进行字符串匹配",
  "title": "从指定位置插入字符串",
  "desc": [
    {
      "content": "\n编写程序，输入字符串S1和S2以及插入位置n，在字符串S1中的指定位置n处插入字符串S2。例如，输入“jiangsu”、“123”和位置3，则输出“ji123angsu”。",
      "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;\nint main()\n{\n\tstring str1;\n\tstring str2;\n\tint pos;\n\tdo\n\t{\n\t\tif ((cin >> str1 >> str2 >> pos) && (pos >= 1))\n\t\t{\n\t\t\tstr1.insert(pos - 1, str2);\n\t\t\tcout << str1 << endl;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcout << \"Invalid Input\" << endl;\n\t\t\tbreak;\n\t\t}\n\t} while (false);\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-1ef5eb82d2104bb499ae0d7c160eca08",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600469953"
}