-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path荣耀03.py
40 lines (36 loc) · 866 Bytes
/
荣耀03.py
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
import sys
def find_recusion(i,s):
if not s[i].isalpha():
return ""
n = len(s)
temp = s[i]
if temp.lower() not in s[i:]:
return ""
i = s.index(temp.lower())
temp +=s[i]
while i+1 < n:
if s[i+1].isdigit() and s[-1].lower() <s[i+1].lower():
pass
else:
i +=1
return temp
def get_recusion(s):
if len(s)<=1:
return 0
result = []
for i in range(len(s)):
#以每一个字母开头
if not s[i].isalpha():
continue
res = find_recusion(i,s)
if len(res) >0:
result.append(res)
return result
if __name__ == "__main__":
# 读取第一行的n 猪的价值
s = str(sys.stdin.readline().strip())
res = get_recusion(s)
if res ==0:
print("Not Found")
for re in res:
print(re)