{
  "question_id": 7457714,
  "question_title": "判断字符串是否连续",
  "question_content": "编写程序实现判断一个字符串中的英文字母是由连续的英文字母组成的\n \n \n 比如“ABC”或“DCAB”都是连续的",
  "difficulty": "中等",
  "answer_id": 53442184,
  "answer_content": "<pre>\n<code class=\"language-cpp\">#include&lt;iostream&gt;\n#include&lt;algorithm&gt;\nusing namespace std;\nint main()\n{\n    char ans[4]&#61;{&#39;A&#39;,&#39;B&#39;,&#39;C&#39;,&#39;D&#39;};\n    sort(ans,ans&#43;4);    /* 这个sort可以不用&#xff0c;因为{1&#xff0c;2&#xff0c;3&#xff0c;4}已经排好序*/\n    do                             /*注意这步&#xff0c;如果是while循环&#xff0c;则需要提前输出*/\n    {\n        for(int i&#61;0;i&lt;4;&#43;&#43;i)\n            cout&lt;&lt;ans[i]&lt;&lt;&#34; &#34;;\n        cout&lt;&lt;endl;\n    }while(next_permutation(ans,ans&#43;4));\n    return 0;\n}</code></pre>\n\n<p> 去判断吧。</p>\n\n<p> </p>\n",
  "tag_name": "c++",
  "cpp": "#include<iostream>\n#include<algorithm>\nusing namespace std;\nint main()\n{\n\tchar ans[4]={'A','B','C','D'};\n\tsort(ans,ans+4);\t\n\tdo\t\t\t\t\t\t\t \n\t{\n\t\tfor(int i=0;i<4;++i)\n\t\t\tcout<<ans[i]<<\" \";\n\t\tcout<<endl;\n\t}while(next_permutation(ans,ans+4));\n\treturn 0;\n}",
  "topic_link": "https://bbs.csdn.net/topics/600470179",
  "status": 0,
  "keywords": "算法高阶,字符串匹配,算法问题选编,利用有限自动机进行字符串匹配",
  "license": "csdn.net",
  "notebook": {
    "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/124.ipynb?type=file"
  },
  "author": "qq_45808872"
}