题解 | #字符串排序#

字符串排序

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

state = str(input())
alpha = ''
for i in state:
    if i.isalpha():
        alpha += i

alpha = sorted(alpha, key = str.upper)
res = ''
for i in range(len(state)):
    if state[i].isalpha():
        res += alpha.pop(0)
    else:
        res += state[i]
print(res)

全部评论

相关推荐

迷茫的大四🐶:自信一点,我认为你可以拿到50k,低于50k完全配不上你的能力,兄弟,不要被他们骗了,你可以的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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