7-22 will not be repeated output 10 letters of the alphabet (50 minutes)

A random input string, the leftmost 10 will not be repeated letters (case insensitive) picked. If there is no 10 letters, display information "not found"

Input formats:

Input string in a row

Output formats:

Leftmost output 10 will not be repeated in a row of letters or display information "not found"

Sample Input 1:

Here we are given a set of inputs. E.g:

poemp134

Output Sample 1:

Given here corresponding output. E.g:

not found

Sample input 2

Here we are given a set of inputs. E.g:

This is a test example

Output Sample 2:

Given here corresponding output. E.g:

Thisaexmpl
s = input()
t = ''.join([i for i in s if i.isalpha()])
result = ''.join([t[i] for i in range(len(t))if t[i].upper() not in t[:i].upper()])
if len(result) > 9:
    print(result[:10])
else:
    print("not found")

  

Guess you like

Origin www.cnblogs.com/aimilu/p/11818823.html