题解 | #字符串排序#

字符串排序

https://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584

list_str=list(input())
list_d=list(filter(lambda x:x.isalpha(),list_str))
list_ds=sorted(list_d,key=lambda x:x.lower())
for i in range(len(list_str)):
    if list_str[i].isalpha():
        list_str[i]=list_ds[0]
        list_ds.pop(0)
print(*(list_str),sep="")

全部评论

相关推荐

青春运维少年不会梦到...:实习大王
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务