题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584
s = input()
a = ''
for i in s:
#isalpha判断字符串至少有一个字符并且所有字符都是字母则返回True
if i.isalpha():
a += i
b = sorted(a,key=str.upper)
index = 0
c = ''
#遍历原字符串,判断是否是字母,如果是字母,则将排序后的字母替换到原字符串中的位置,如果不是字符,则照常添加到新的字符串后
for i in s:
if i.isalpha():
c += b[index]
index +=1
else:
c += i
print(c)

