题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584
while True: try: s = input() # 将字母排序 a = "" for i in s: if i.isalpha(): a = a + i b = sorted(a, key = str.upper) # 将特殊字符放到原有位置 index = 0 output = "" for i in s: if i.isalpha(): #当原位置是字母时, 放一个字母到output里面; 选取的字母为b[index] output = output + b[index] index += 1 else: output += i print(output) except: break