题解 | #字符串排序#

字符串排序

https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723

while True:
    try:
        num = int(input())
        list1 = []
        if num >=1 and num <=1000:
            for i in range(num):
                str1 = input()
                if len(str1) >= 1 and len(str1) <= 100:
                    list1.append(str1)
                else:
                    break
        for j in sorted(list1):
            print(j)
    except:
        break

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务