solution.json 1.8 KB
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "1cd4d9de21f34c9e921c06dc12d6fa1e",
  "keywords": "算法高阶,字符串匹配,算法问题选编,利用有限自动机进行字符串匹配",
  "title": "python 输出不重复的字符",
  "desc": [
    {
      "content": "\n<pre><p>输入一个字符串&#xff0c;把最左边的10个不重复的字符&#xff08;大小写算不同字符&#xff09;挑选出来。 如不重复的字符不到10个&#xff0c;则按实际数目输出。\n输入格式:\n输入一个字符串s。\n输出格式:\n输出一个字符串&#xff0c;包含字符串s最左边10个不重复的字符。不到10个按实际输出。</pre>\n输入样例1:</p>\n<code>Hello world, hello python</code>\n<p>输出样例1:</p>\n<pre>\n<code>Helo wrd,h</code></pre>\n<p>输入样例2:</p>\n<pre>\n<code>succeed</code></pre>\n<p>输出样例2:</p>\n<pre>\n<code>suced</code></pre>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "python"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ]
  ],
  "template": {
    "content": "def unique(s):\n\tset1 = set([])\n\tout = \"\"\n\tfor i in range(len(s)):\n\t\tc = s[i]\n\t\tif c not in set1:\n\t\t\tout = out + c\n\t\t\tset1.add(c)\n\treturn out[0:10]\ndef main():\n\tstrin = \"Hello world, hello python\"\n\tret = unique(strin)\n\tprint(ret)\nif __name__ == '__main__':\n\tmain()",
    "language": "python"
  },
  "node_id": "dailycode-be86731880ca4fb99657c3f64cd64235",
  "license": "csdn.net",
  "created_at": 1637894161,
  "topic_link": "https://bbs.csdn.net/topics/600470410"
}