{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "6a96da0476194aacb15c98e7b2ad9c40",
  "keywords": "算法高阶,字符串匹配,算法问题选编,利用有限自动机进行字符串匹配",
  "title": "字符串排序",
  "desc": [
    {
      "content": "\n编写程序，输入若干个字符串。\n要求:\n（1）按字符串长度的大小升序输出各个字符串。\n（2）按字符串中字符的ASCII码值大小升序输出各个字符串。",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <string>\n#include <iostream>\n#include <algorithm>\n#include <vector>\nusing namespace std;\nbool compare(string a,string b) {\n\tif (a.length() != b.length()) {\n\t   return a.length() < b.length();\n\t}\n\treturn a < b;\n}\nint main()\n{\n\tvector<string>list;\n\tstring inputString;\n\twhile (cin>>inputString) {\n\t\tif (inputString == \"0\") {\n\t\t\tbreak;\n\t\t}\n\t\tlist.push_back(inputString);\n\t}\n\tsort(list.begin(),list.end(),compare);\n\tfor (int i=0; i<list.size(); i++) {\n\t\tcout<<list[i]<<endl;\n\t}\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-686a56ba3191489fa5065485ce174e28",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470184"
}