全题解析链接
随机输入一个字符串,把最左边的10个不重复的英文字母(不区分大小写)挑选出来。 如没有10个英文字母,显示信息“not found”
输入格式:
在一行中输入字符串
输出格式:
在一行中输出最左边的10个不重复的英文字母或显示信息“not found"
输入样例1:
在这里给出一组输入。例如:
poemp134567
输出样例1:
在这里给出相应的输出。例如:
not found
输入样例2
在这里给出一组输入。例如:
This 156is a test example
输出样例2:
在这里给出相应的输出。例如:
Thisaexmpl
题解:
- s = input().strip()
- li = []
- for i in s:
- if i.isalpha() and (i.upper() not in li and i.lower() not in li) :
- li.append(i)
- if len(li)<10:
- print('not found')
- else:
- for i in li[:10]:
- print(i,end='')
全题解析链接
随机输入一个字符串,把最左边的10个不重复的英文字母(不区分大小写)挑选出来。 如没有10个英文字母,显示信息“not found”
输入格式:
在一行中输入字符串
输出格式:
在一行中输出最左边的10个不重复的英文字母或显示信息“not found"
输入样例1:
在这里给出一组输入。例如:
poemp134567
输出样例1:
在这里给出相应的输出。例如:
not found
输入样例2
在这里给出一组输入。例如:
This 156is a test example
输出样例2:
在这里给出相应的输出。例如:
Thisaexmpl
题解:
- s = input().strip()
- li = []
- for i in s:
- if i.isalpha() and (i.upper() not in li and i.lower() not in li) :
- li.append(i)
- if len(li)<10:
- print('not found')
- else:
- for i in li[:10]:
- print(i,end='')
评论记录:
回复评论: