随机输入一个字符串,把最左边的10个不重复的英文字母(不区分大小写)挑选出来。 如没有10个英文字母,显示信息“not found”

输入格式:

在一行中输入字符串

输出格式:

在一行中输出最左边的10个不重复的英文字母或显示信息“not found"

输入样例1:

在这里给出一组输入。例如:

poemp134

输出样例1:

在这里给出相应的输出。例如:

not found

输入样例2

在这里给出一组输入。例如:

This is a test example

输出样例2:

在这里给出相应的输出。例如:

Thisaexmpl

代码如下:

#!/usr/bin/python
# -*- coding: utf-8 -*-

s = list("".join(input().split(" ")))

r = list()

for i in s:
    if ord(i) in range(97,123) or ord(i) in range(65,91):
        if i not in r and i.lower() not in r and i.upper() not in r:
            r.append(i)
    if len(r) == 10:
        break

if len(r) == 10:
    print("".join(r))
else:
    print("not found")

这个代码不难,主要就是细节拼凑。


读书和健身总有一个在路上

相关文章:

  • 2022-12-23
  • 2022-01-19
  • 2022-02-18
  • 2022-01-21
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2018-06-14
  • 2021-08-26
相关资源
相似解决方案