题解 | #字符串排序#
字符串排序
http://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
我写的比较复杂看着。
def check_l(l: list):
if len(l) > 1 and l[0].isdigit() and 1 <= int(l[0]) <= 1000 and int(l[0]) == (len(l)-1):
for i in l[1:]:
if len(i) > 100 or len(i) < 1:
return False
else:
return False
return True
while True:
try:
s = input()
s_l.append(s)
except EOFError:
if check_l(s_l):
s_l.pop(0)
new_list = list(sorted(s_l))
for i in new_list:
print(i)
break