点击链接PTA-Python-AC全解汇总
题目:
随机输入一个字符串,把最左边的10个不重复的英文字母(不区分大小写)挑选出来。 如没有10个英文字母,显示信息“not found”
输入格式:
在一行中输入字符串
输出格式:
在一行中输出最左边的10个不重复的英文字母或显示信息“not found"
输入样例1:
poemp134
- 1
输出样例1:
not found
- 1
输入样例2
This is a test example
- 1
输出样例2:
Thisaexmpl
- 1
我的代码:
str=input()
res=""
for x in str:
if x not in res and x.isalpha() and x.upper() not in res.upper():
res=res+x
if len(res)>=10:
break
if len(res)<10:
print("not found")
else:
print(res)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
评论记录:
回复评论: